I work usually with gprof + gprof2dot.py to profile C++ codes. A new code I am working with uses very long function names, so that the graphical results with gprof2dot.py are a mess. I wonder how can one shorten the function names so that they fit in a small box.
Asked
Active
Viewed 825 times
2 Answers
3
Just add --strip
(for shortening) and --wrap
(for line wrapping) to gprof2dot
and the labels get narrowed.
Seen in the gprof2dot documentation here:
The node labels are too wide. How can I narrow them?
The node labels can get very wide when profiling C++ code, due to inclusion of scope, function arguments, and template arguments in demangled C++ function names.
If you do not need function and template arguments information, then pass the
-s
/--strip
option to strip them.If you want to keep all that information, or if the labels are still too wide, then you can pass the
-w
/--wrap
, to wrap the labels. Note that because dot does not wrap labels automatically the label margins will not be perfectly aligned.
-
1Hi @frans, As you noticed, the link in the first answer eventually [rotted away](https://en.wikipedia.org/wiki/Link_rot); that's why it's best to copy paste (with attribution!) the essential parts of the answer here in case the link rots away again. – durron597 Aug 28 '15 at 14:24