caohaiwd / gperftools

Automatically exported from code.google.com/p/gperftools
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Patch to support callgrind in interactive mode #219

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Currently, interactive mode has no callgrind support.

What version of the product are you using? On what operating system?

1.5

Please provide any additional information below.

The use case was: I would like to process a profile into a text and a
callgrind without doing the time intensive symbol lookup twice. 
The patch enables writing to file and starting kcachegrind from the 
interactive commandline. I do not know perl, I just did cut'n'paste
programming, but for me, it worked.

Original issue reported on code.google.com by weidenri...@gmx.de on 26 Feb 2010 at 1:33

Attachments:

GoogleCodeExporter commented 9 years ago
Two more patches for pprof --interactive
a) do not use readline, when STDIN is not a terminal

Original comment by weidenri...@gmx.de on 7 Mar 2010 at 10:49

Attachments:

GoogleCodeExporter commented 9 years ago
b) write comments and (pprof) to stderr, not to disturb output generated by 
echo "
  top50 
  callgrind /tmp/callgrind
  quit
" | pprof --interactive

Original comment by weidenri...@gmx.de on 7 Mar 2010 at 10:51

Attachments:

GoogleCodeExporter commented 9 years ago
I guess I don't totally understand the motivation for these patches.  Why not 
just do
   pprof --callgrind
and
   pprof --text
?  It seems weird to have a non-interactive --interactive mode.

Original comment by csilv...@gmail.com on 7 Mar 2010 at 11:26

GoogleCodeExporter commented 9 years ago
The reason for the weird non-interactive --interactive mode is speed:
The symbol detection is only done once, and sometimes this can save me more 
than 15
minutes.

Original comment by weidenri...@gmx.de on 7 Mar 2010 at 11:44

GoogleCodeExporter commented 9 years ago
Isn't that what --raw mode is supposed to address?  What happens if you use 
--raw to 
create a raw profile, and then try to call --callgrind and --text on that?

Original comment by csilv...@gmail.com on 8 Mar 2010 at 7:41

GoogleCodeExporter commented 9 years ago
I fully agree, --raw would be the canonical way for this, but see
http://code.google.com/p/google-perftools/issues/detail?id=219 ... it does not
support lines. :-)

Original comment by weidenri...@gmx.de on 9 Mar 2010 at 7:59

GoogleCodeExporter commented 9 years ago
I wonder if it's better to fix that bug instead.  It will make --raw more 
useful for 
all kinds of things, and then obviate the need to abuse --interactive mode like 
this.

Another alternative would be to change pprof to allow multiple flags at once.  
That 
idea's been suggested before as well.  It's a bit tricky since sometimes 
different 
flags want to output to the same place, but maybe we could figure out a way.  
But I 
bet augmenting --raw support will be easier and work just as well.

Original comment by csilv...@gmail.com on 9 Mar 2010 at 7:00

GoogleCodeExporter commented 9 years ago
Again, I agree. Additionally I think that the two patches, 
a) do not use "readline" when stdin is not a tty and 
b) write diagnostic output to STDERR as it is done in the rest of pprof, are an
improvement in their own right. 

Original comment by weidenri...@gmx.de on 10 Mar 2010 at 8:59

GoogleCodeExporter commented 9 years ago
Fair enough.  I'll pass them along to the pprof experts here for their 
consideration.

Original comment by csilv...@gmail.com on 10 Mar 2010 at 4:23

GoogleCodeExporter commented 9 years ago
OK, everyone's on board with these changes.  They'll be in the next release.

Original comment by csilv...@gmail.com on 10 Mar 2010 at 6:01

GoogleCodeExporter commented 9 years ago
This is in perftools 1.6, just released.

Original comment by csilv...@gmail.com on 5 Aug 2010 at 8:49