Change the name of the gmon.out file at compilation with -pg

Is it possible to change the default name of the gmon.out file that is created when the profile flag (-pg) is set when compiling with gcc, for example, [executable name] .gmon.out?

I need this because I have several executables that are in the same directory and must run in parallel.

+3
source share
2 answers

Not so short, but actually the answer is YES - when using glibc(at least with version 2.11.1, which is the version I used for testing).

-pg , gmon.out, GMON_OUT_PREFIX , [value of your choice].[pid], [pid] , .

+10

, . , -pg, gmon.out. (, foo.bar) , :

gprof test.exe foo.bar > analysis.txt
0

Source: https://habr.com/ru/post/1760698/


All Articles