gprof profiling of multi-threaded Cygwin programs

Corinna Vinschen
Thu Feb 18 11:29:00 GMT 2016

On Feb 18 10:59, Jon Turney wrote:
> 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.

Good point.


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <>

More information about the Cygwin-patches mailing list