[PATCH] gprof profiling of multi-threaded Cygwin programs, ver 2

Corinna Vinschen corinna-cygwin@cygwin.com
Tue Feb 23 11:14:00 GMT 2016


On Feb 22 23:36, Mark Geisert wrote:
> Hi Jon,
> 
> On Mon, 22 Feb 2016, Jon Turney wrote:
> >Thanks for this.  A few comments inline.
> >
> >On 20/02/2016 08:16, Mark Geisert wrote:
> >>+/* Called from profil.c to sample all non-main thread PC values for
> >>profiling */
> >>+extern "C" void
> >>+cygheap_profthr_all (void (*profthr_byhandle) (HANDLE))
> >>+{
> >>+  for (uint32_t ix = 0; ix < nthreads; ix++)
> >>+    {
> >>+      _cygtls *tls = cygheap->threadlist[ix].thread;
> >>+      if (tls->tid)
> >>+	profthr_byhandle (tls->tid->win32_obj_id);
> >>+    }
> >>+}
> >
> >There doesn't seem to be anything specific to profiling about this, so it
> >could be written in a more generic way, as "call a callback function for
> >each thread".
> 
> I saw your later conversation with Corinna on the list re why
> cygwin_internal() is involved now.  (I too had stumbled over the
> cygwin1.dll/libgmon.a gap when I started this work.)  Given the necessity of
> the separation, does it still make sense to write a generic per-thread
> callback mechanism and then make use of it for this patch, or is that
> overkill?  I can't tell.

One problem with a generic solution is to generalize the arguments to
the called function.  IMHO, keep it as is for now.  If we ever need to
make this generic we can still do it.

> >>+	if ((prefix = getenv("GMON_OUT_PREFIX")) != NULL) {
> >
> >setup-env.xml might be an appropriate place to mention this environment
> >variable.
> 
> I am now writing a gprof.xml that will be tied into the existing
> programming.xml.  I plan to document GMON_OUT_PREFIX in gprof.xml.  Do you
> think that's sufficient?

A single paragraph in setup-env.xml pointing to gprof.xml might be
helpful, I think.


Corinna

-- 
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: <http://cygwin.com/pipermail/cygwin-patches/attachments/20160223/cc15cc05/attachment.sig>


More information about the Cygwin-patches mailing list