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]

[PATCH] Support profiling of multi-threaded apps.


This is Version 3 incorporating review comments of Version 2. This is just the code patch; a separate doc patch is forthcoming.

Change log relative to winsup/cygwin:

        * include/sys/cygwin.h: Add CW_CYGHEAP_PROFTHR_ALL.
        * cygheap.cc (cygheap_profthr_all): New C-callable function that
        runs cygheap's threadlist handing each pthread's thread handle in
        turn to profthr_byhandle().
        * external.cc (cygwin_internal): Add case CW_CYGHEAP_PROFTHR_ALL.
        * gmon.c (_mcleanup): Add support for multiple simultaneous
        gmon.out* files named via environment variable GMON_OUT_PREFIX.
        * gmon.h (struct gmonparam): Make state decl volatile.
        * mcount.c (_MCOUNT_DECL): Change stores into gmonparam.state to use
        Interlocked operations. Add #include "winsup.h", update commentary.
        * profil.c (profthr_byhandle): New function abstracting out the
        updating of profile counters based on a thread handle.
        (profthr_func): Update to call profthr_byhandle() to sample the main
        thread then call cygheap_profthr_all() indirectly through
        cygwin_internal(CW_CYGHEAP_PROFTHR_ALL) to sample all other threads.
        (profile_off): Zero targthr to indicate profiling was turned off.
        (profile_on): Fix handle leak on failure path.
        (profile_child): New callback func to restart profiling in child
        process after a fork if the parent was being profiled.
        (profile_ctl): Call pthread_atfork() to set profile_child callback.

Thanks,

..mark

Attachment: 0001-Support-profiling-of-multi-threaded-apps.patch
Description: Text document


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