1
votes

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?

2
isn't it the other way round, pprof ./prog info.prof?Pavel
No, the pprof ./prog info.prof command doesn't work too.Mind Mixer
how does the error message look like?Pavel
Similar: Reading Profile files in profile.* Error: Could not open profile.0.0.0: No such file or directory profile.ftab: No such file or directoryMind Mixer

2 Answers

9
votes

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

7
votes

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.