Does anyone know what this error means for gprof
? I'm running gcc -pg
. Thanks.

- 19,515
- 28
- 127
- 217
-
What platform? Also did you mean `samples` instead of `bins`? – ismail Jan 02 '11 at 19:41
-
6`crystalball: command not found` – Jan 02 '11 at 19:51
-
Can't help you if all you want to do is run gprof. If you want to find performance problems, [do this](http://stackoverflow.com/questions/375913/what-can-i-use-to-profile-c-code-in-linux/378024#378024). – Mike Dunlavey Jan 03 '11 at 14:57
3 Answers
As this question is the top result on Google :
You probably ran gprof the wrong way compile with the -pg flag execute your binary it will also output a "gmon.out" file
then run :
gprof {executable} gmon.out > profile
the "profile" file should contain the results of gprof

- 4,724
- 27
- 33
-
1+1. I think (not sure) that the issue is that if your program is not called `a.out`, gprof will give up unless you tell it the explicit executable file. – wchargin Apr 11 '15 at 18:19
I encountered the same problem. I was running gprof directly after compiling the code on the executable. We need to do the following:
Compile the code using -pg -g option as follows:
gcc -g -pg myfile.c -o myfile.out
Run the executable without using gprof first (The first run creates gmon.out)
myfile.out 100 200 400 % where 100, 200 and 400 are my input parameters to myfile.out
Step 2 creates gmon.out by default. You need to feed this and the executable to gprof to create the runtime profile of the executable.
gprof myfile.out gmon.out % redirect this to a file
The file will contain the executable profile.

- 1,944
- 8
- 23
- 30
Hard to tell with so little information. This can happen in particular if you messed up with the arguments you're giving to gprof
, as reported here (which was hard to find, because it's only Google's 2nd hit for your question's title).
Edit: so, double check your arguments. If you want us to check them for you, report the command-line you used, and how the various files were generated. As a rule: we can't guess.

- 12,105
- 7
- 71
- 123