hhafez hhafez - 5 months ago 5
Linux Question

Any way to specify the location of profile data

The default the profile file is from the executable is run and the file is called

. Is there any way to specify a new location?

I'm using gcc 3.4.6 on i386/linux2.6


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:

GMON_OUT_PREFIX=mygmon; gcc -o foo -pg foo.c

the gmon out file is: mygmon.12345, assuming the foo process id=12345.