Can't analyse the output (the profile file) of gperftools profiler

4.1k Views Asked by At

I'm using gperftools for analysing my C code. An as a result I can't analyze the profile file using pprof application.

$ gcc -g prog.c -o prog -lprofiler
$ export CPUPROFILE=info.prof
$ ./prog 

 Inside main()

 Inside func1 

 Inside new_func1()

 Inside func2 
PROFILE: interrupts/evictions/bytes = 1133/0/300
$ ls
info.prof  prog  prog.c
$ ls -lah info.prof 
-rw-rw-r-- 1 mm mm 2.6K Jun  6 09:36 info.prof
$ pprof info.prof prog
Reading Profile files in profile.*
Error: Could not open profile.0.0.0: No such file or directory
profile.ftab: No such file or directory
$ 

What do I wrong? What's the profile.ftab file?

3

There are 3 best solutions below

0
On BEST ANSWER

You're not using the correct 'pprof' tool. In particular, you're using http://www.cs.uoregon.edu/research/tau/docs/newguide/bk03ch01s08.html (which is totally unrelated), whereas you need the one here: https://code.google.com/p/gperftools/ I had the same issue and solved the problem by downloading the gperftools' source, building it, and using ./src/pprof

0
On

You installed the wrong pprof.

If you already have golang installed. You can install pprof using go. Just do,

go get github.com/google/pprof

Also install graphviz if you want to generate PDFs using

sudo apt-get install graphviz
0
On

I just ran into this and I think it is worth mentioning how to deal with this in recent versions of Ubuntu (18.04 specifically).

When one tries to run the pprof command, the system suggests installing the tau package:

Command 'pprof' not found, but can be installed with:

sudo apt install tau

Do not install that package though, because it is entirely unrelated as David Carney pointed out in his answer. Install the google-perftools package instead, but be aware that the executable in it is called google-pprof instead of just pprof.