Recommending – gprof2dot script

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 | | 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.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s