gprof profiling of multi-threaded Cygwin programs
Jon Turney
jon.turney@dronecode.org.uk
Thu Feb 18 10:59:00 GMT 2016
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.
More information about the Cygwin-patches
mailing list