ssett / gperftools

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

C gperftools - profiling C code line by line of source code #663

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

I am trying to generate profiling (line by line of source code) for my code for 
which I have used gperftools.

gcc a.c -lprofiler -Wl,--no-as-needed -lprofiler -Wl,--as-needed

CPUPROFILE=out.ptof ./a.out 

But

pprof  ./a.out out.ptof --inuse_objects --lines --heapcheck  
--edgefraction=1e-10 --nodefraction=1e-10 --gv
Using local file ./a.out.
Using local file out.ptof.
No nodes to print

Why pprof states "No nodes to print"?

gprof/examples# pprof --v
pprof (part of gperftools 2.0)

Copyright 1998-2007 Google Inc.

This is BSD licensed software; see the source for copying conditions
and license information.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

Original issue reported on code.google.com by satyapra...@gmail.com on 24 Dec 2014 at 7:59

GoogleCodeExporter commented 9 years ago
You seemingly invoke pprof for heapcheck dump rather than cpu profile.

try something like pprof --text ./a.out out.ptof (or --web)

Original comment by alkondratenko on 24 Dec 2014 at 8:15

GoogleCodeExporter commented 9 years ago
My code is just a sample one to print a couple of strings:

gprof/examples# gcc a.c -lprofiler -Wl,--no-as-needed -lprofiler -Wl,--as-needed
gprof/examples# CPUPROFILE=out.ptof ./a.out 
Hi
Hi
Hi
Hi
Hi
Hi
Hi
Hi
Hi
Hi
Hi
Hi
PROFILE: interrupts/evictions/bytes = 0/0/64
gprof/examples# pprof --text ./a.out out.ptof 
Using local file ./a.out.
Using local file out.ptof.
gprof/examples# 

Still nothing comes out

gprof/examples# pprof --web ./a.out out.ptof 
Using local file ./a.out.
Using local file out.ptof.
No nodes to print

Original comment by satyapra...@gmail.com on 24 Dec 2014 at 8:36

GoogleCodeExporter commented 9 years ago
Your program might be running too quickly to produce any profiling samples. You 
will need at least few seconds of samples to have near-meaningful profile. You 
can also look at cpu profiling frequency knob.

Original comment by alkondratenko on 24 Dec 2014 at 5:15

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I'm going to close this bug as "cannot reproduce" due to my comment above that 
your program likely runs too quickly to gather any profiling samples.

If that is not the case, please reopen. And consider uploading some test 
program that reproduce that problem so that I can investigate.

Thanks.

Original comment by alkondratenko on 7 Feb 2015 at 7:07