tags:

views:

182

answers:

4

I tried to find a related question but all previous questions are about profilers for native c++ in windows. I googled a while and learned about gprof, but the output of gprof actually contained lot of obscure internal functions. Is there a good opensource c++ profiler with good documentation?

+2  A: 

Valgrind

I totally recommend this http://en.wikipedia.org/wiki/Valgrind

iamslash
A: 

Compile using the flag -pg and use gprof.

LiraNuna
can you please suggest a good gprof tutorial.
Algorist
+3  A: 

Don't use gprof, for the reasons given here.

What you need are stackshots, explained here. One way to take stackshots is the pstack utility. Another way is to use "Pause" or ctrl-break under the debugger. Also lsstack, if you can get a copy.

If you want to spend money, RotateRight makes a nice tool based on stack sampling called Zoom.

Mike Dunlavey
A: 

If you don't mind the KDE library dependencies, KCachegrind is very useful with the added visualization. It depends on Callgrind and Valgrind, as one could have guessed, so no special compiler flags required during compile-time.

okun