Good C ++ Profiler for GCC

I tried to find a related question, but all of the previous questions relate to profilers for the native C ++ language in windows. For a while I searched Google and found out about gprof, but gprof really did contain a lot of obscure internal functions. Is there a good open source C ++ profiler with good documentation?

+7
c ++ profiling
source share
6 answers

Valgrind

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

+7
source share

Do not use gprof for the reasons indicated here .

What you need is stackshots, here . One way to do stackshots is with 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 good stack-based tool called Zoom .

+6
source share

Compile using the -pg flag and use gprof .

+3
source share

If you don't mind the dependencies of the KDE library, KCachegrind is very useful with added visualization. It depends on Callgrind and Valgrind, as you might have guessed, so no special compiler flags are required during compilation.

0
source share

I heard that oprofile is really, really good for real-time applications. Linux only though AFAIK.

0
source share

How much will you need in the reports of your profile. If you just want to make very simple time profiling for several functions, then the new functionality, available with the C ++ 11 chrono , simplifies the cross-platform profile, the cross-compiler.

See this article for some simple profiling code that works similar to Matlab's super easy to use tic and toc functions.

0
source share

All Articles