g++ and most compilers can do what you want. It is called profiling. Also there is the oprofile. A profiler gives you the call graph of an application after
its execution. This is very useful to study code, you can also walk through the [debug] output as you look at the graph. A code analyzer, in contrast, will give you all possible call paths however, you will not be able to see the significant path easily.