Any way to specify the location of profile data

前端 未结 4 2066
青春惊慌失措
青春惊慌失措 2021-01-01 22:03

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条回答
  •  太阳男子
    2021-01-01 22:45

    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.

提交回复
热议问题