Reprinted from:
C + + Performance Test Tool Gprof + kprof + gprof2dot in Linux environments
Add-PG Compilation options:
gcc/g++-G-PG File.c[c]
Run a.out to generate Gmon.out
./a.out
Generate Intermediate Analysis files
Gprof./a.out > Prof.log
Abbreviated brief output of common parameters-B brief
Gprof-b./a.out > Prof.log
-Q print Function call relationship
Gprof-q./a.out > Prof.log
-P Print a flat profile
Gprof-p./a.out > Prof.log
https://github.com/jrfonseca/
Generate Program Flowchart
Gprof./test | gprof2dot.py | Xdot
Gprof-b./test Gmon.out | Gprof2doc > A.dot
Gprof2dot default is a partial function call graph, does not have the performance influence small function call to display, for example does not appear in the class construction, the destructor,
If you want to display all of the function calls, you can gprof2dot-n0-e0 , the default is n0.5, which affects less than 5% of the function is not displayed.
Of course, this picture will be very messy, because the display of a lot of content, you can gprof2dot-n0-e0-s #-s that does not display such as templates, function entry parameters and so on, so that
Function name display is more streamlined.
Gprof-C + + performance analysis tool