I have seen such a program in accident, but I forget the name and can not find it anymore.
It works just like line profiler. Well, when I saw it, it's an article comparing it with line profiler. The results are more friendly. They are like
main 100%
-fun1 95%
-subfun1 80%
...
-fun2 5%
-subfun1 4%
...
By result like this, I can know where subfun1 is called most.