Reputation: 14664
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?
Upvotes: 10
Views: 17817
Reputation: 40699
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.
Upvotes: 6
Reputation: 16193
How much detail do you need in your profile reports. If you just want to do some really simple time profiling for a few functions, then the new functionality available via the C++11 chrono
classes makes it easy to profile in a cross platform, cross compiler way.
See this article for some simple profiling code that works similarly to Matlab's super easy to use tic
and toc
functions.
Upvotes: 0
Reputation: 8865
I've heard oprofile is really, really good for real time apps. Linux only though, AFAIK.
Upvotes: 0
Reputation: 338
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.
Upvotes: 1
Reputation: 126
Valgrind
I totally recommend this http://en.wikipedia.org/wiki/Valgrind
Upvotes: 10