The default the profile file is from the executable is run and the file is called gmon.out
. Is there any way to specify a new location?
I'm using gcc 3.4.6 on i386/linux2.6
The default the profile file is from the executable is run and the file is called gmon.out
. Is there any way to specify a new location?
I'm using gcc 3.4.6 on i386/linux2.6
jscoot's solution worked for me. but setting GMON_OUT_PREFIX is important at execution time, not at compile time.
I encountered the same problem last week and I solved it in the following way. idea here is to change the process current directory to wherever you want to generate gmon.out file. file name can't be changed this way. It allows you to change where you can save the file.
Too badly, the environment variable
GMON_OUT_PREFIX
is not documented in the glibc. I got the following information from the web and tested on my machine.if you set the environment variable
GMON_OUT_PREFIX
, then the output file is named as${GMON_OUT_PREFIX}.[PID]
, the pid is the id of the profiled process.For example:
the gmon out file is:
mygmon.12345
, assuming the foo process id=12345.To give a different file name to gprof:
As to renaming them, set the GMON_OUT_PREFIX environment variable. I found this one by good ol' objdump on libc .... Naturally, the libc docs say nothing.