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


On Thu, 18 Feb 2016, Jon Turney wrote:
On 18/02/2016 11:29, Mark Geisert wrote:
A brief search tells me that apparently glibc supports the
(undocumented) GMON_OUT_PREFIX env var which enables a similar behaviour.

Ah, I did not know about that.  It would be easy to implement.

So I'm leaning towards choosing file name as GMON_OUT_PREFIX.exename.pid
with GMON_OUT_PREFIX defaulting to "gmon.out" if unspecified.

I think if you are going to implement GMON_OUT_PREFIX, you should make the behaviour the same as glibc.

Do you think the expanded name should be used in all cases, or only when
there's a gmon.out already present?

I don't think you should be checking for an existing gmon.out file. In the simple case where the program doesn't fork, it's expected that gmon.out will get overwritten.

OK, so the file name would be "gmon.out" if GMON_OUT_PREFIX is not specified, and $GMON_OUT_PREFIX.$pid if it is. And don't check for existing files in either case.

I was also worried about a profiled program fork/exec'ing a different profiled program and so I considered having $exename be part of the file name. But I now think following the undocumented glibc behavior is better in the long run. One can arrange a different GMON_OUT_PREFIX for the execee if that's truly necessary.

Thanks; I appreciate the feedback.

..mark


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