casseopea2 / gperftools

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

Could not get the correct call graph after cpu profiling #140

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Good tool, but I used the tool to do cpu profiling of memcached-1.3.3 in 
RHEL5.2 X86_64, but i only get one prof.out file and there are no other 
files for each thread (as mentioned in the document, the tool will 
generate the files for each thread in Linux 2.6+ ). Another strange 
problem is that the prof.out file is empty, only I terminate the memcached 
progress by kill -2 $pid_memcached, I can see something in the prof.out 
file. Using pprof tool to generate the call graph, I only get the boxes
(the called function and its percentag), and the boxes are disconnected.

1. configuring the google perftool with the enable-frame-pointer: 
  ./configure --enable-frame-pointers CPPFLAGS=-fno-omit-frame-pointer && 
make && make install
2. compiling memcached 
   ./configure LDFLAGS='-L/opt/memcached/lib -L/usr/local/lib' LIBS='-
lprofiler'  CPPFLAGS='-I/opt/memcached/include -DENABLE_MYPTHREAD -fno-
omit-frame-pointer' --prefix=/opt/memcached --exec-prefix=/opt/memcached --
with-libevent=/opt/memcached  --enable-64bit && make && make install
3. I start the profling tool: 
CPUPROFILE=/tmp/prof.out /opt/memcached/bin/memcached -u nobody-p 11000 -m 
2048 -c 3096 -t 8 -d

Original issue reported on code.google.com by mingfan...@gmail.com on 8 Jun 2009 at 1:20

GoogleCodeExporter commented 9 years ago
My understanding is that on newer kernels, we will profile every thread.  
However,
all that data will be put into one output file.  So having one prof.out file is
actually correct.  I'm sorry if the documentation was confusing on that point. 
(There *are* multiple output files if you fork.)

As for the empty prof.out file, how are you terminating the program?  Is it via 
kill?
 If you don't do a normal shutdown, the profile will probably be incorrect.  If you
have a way to cleanly shut down your daemon, that may be the easiest way to see 
if
things are working correctly.  Otherwise, you may try calling DumpProfile()
explicitly in your code somewhere, to see if you can get a valid profile that 
way.

But note that incomplete data like this is expected if you use
--enable-frame-pointers, but do not also compile the libraries you use with 
frame
pointers.  This is because the profiler can't see into any code inside those
libraries.  I see you use libs in /opt/memcached/lib and /usr/local/lib.  My 
guess is
these are not compiled with frame pointers, and are responsible for the 
incomplete
profiles you see.

Original comment by csilv...@gmail.com on 8 Jun 2009 at 7:57

GoogleCodeExporter commented 9 years ago

Original comment by csilv...@gmail.com on 10 Jun 2009 at 2:07

GoogleCodeExporter commented 9 years ago
Any more news on this?  Without more data, I'm going to have to close this 
CannotReproduce.

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

GoogleCodeExporter commented 9 years ago
OK, closing.  Feel free to reopen if you get more data.

Original comment by csilv...@gmail.com on 17 Mar 2010 at 11:28