0

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"?

Programmer
  • 8,303
  • 23
  • 78
  • 162

1 Answers1

0

It seems that there might be several reasons.

Quoting the most likely (assuming your code is light):

If you see a message like "No nodes to print" [...] it simply means that the code was so fast that it couldn't be profiled - basically, the profiler never even had a chance to take a sample.

And:

In the default mode, there will be no profiling data for the 'slow' route, because it uses few CPU cycles (You'll see the message 'No nodes to print').

So you might need to artificially slow down your program...

Community
  • 1
  • 1
n0p
  • 3,399
  • 2
  • 29
  • 50
  • Even though I include dummy for loops .. I still get the same output – Programmer Dec 24 '14 at 09:54
  • Does any of the links related to your issue ? What did you put as "dummy loops" ? – n0p Dec 24 '14 at 09:55
  • I am not sure but now whenever I run I get "Disabling profiler because SIGPROF handler is already in use." message. Dummy lops are just for loops counting from 1 to 100000 – Programmer Dec 24 '14 at 10:36
  • Perhaps something does not end correctly then (already in use) ? You should retry with clean environment. About your loops: if nothing is done on the loop except counting, the compiler might optimize it and ignore it. – n0p Dec 24 '14 at 10:42