This is the mail archive of the cygwin-patches mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gprof profiling of multi-threaded Cygwin programs



Thanks for this.

On 17/02/2016 05:28, Mark Geisert wrote:
There is a behavioral change that ought to be documented somewhere:  If
a gmon.out file exists when a profiled application exits, the app will
now dump its profiling info into another file gmon.outXXXXXX where
mkstemp() replaces the Xs with random alphanumerics.  I added this
functionality to allow a profiled program to fork() yet retain profiling
info for both parent and child.  The old behavior was to simply
overwrite any existing gmon.out file.

Did you consider making the filename deterministic (e.g. based on pid or such) rather than random?

With a random filename, if you have a process which forks more than once, working out which gmon.out* file corresponds to which process could be tricky.

A brief search tells me that apparently glibc supports the (undocumented) GMON_OUT_PREFIX env var which enables a similar behaviour.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]