Doe开发者_StackOverflow中文版s anyone know what this error means for gprof
? I'm running gcc -pg
. Thanks.
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
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.
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.
精彩评论