2

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.

Open the way
  • 26,225
  • 51
  • 142
  • 196

2 Answers2

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.

Community
  • 1
  • 1
frans
  • 8,868
  • 11
  • 58
  • 132
  • 1
    Hi @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
-1

You can narrow the labels using gprof2py. Is this what you were looking for?

durron597
  • 31,968
  • 17
  • 99
  • 158
Gangadhar
  • 1,893
  • 9
  • 9