Gprof2Dot is a Python script for converting output from profiling tools into a dot graph.
Currently supports data from prof, gprof, oprofile, Shark, and python profilers.
You’ll need working Python and dot installation to use the script.
Usage is simple – after building your executable with profiling enabled, run the executable in the usual fashion, and then run
gprof executable | gprof2dot.py | dot -Tpng -o profile.png
which will create a profile.png graph image, that will give you a much better insight into the profile than the plain text file gprof(1) produces.
For more examples and information see Gprof2Dot’s homepage.
Sometimes you might get a message in the style of “assert numerator <= denominator, AssertionError”.
This is due to rounding done by the profiling tools when printing out results, when sum of percents can go over 100%. Simply rerun the executable, and try to create the profile image again.