This is the mail archive of the cygwin@cygwin.com 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: Is multithreaded profiling on cygwin possible?


peter garrone wrote:

>If I profile my multi-threaded application, it appears that only the main
>thread is profiled.
>
Currently, yes.

You can, however, profile other threads one at a time if you use
the gprof API's manually, called from the thread you want to profile.  I
have done this, but it has been too long for me to give you specific
instructions.  Have a look at profile.c, profile.[ch], gmon.[ch] in the
cygwin sources to see how its done.

PTC
While you're there, it should be fairly trivial to create a patch that
at least loops through all Cygwin created pthreads in the sampler.  I
don't know if that kind of flat profile is what you wanted, though.

BTW, code in DLL's is difficult to profile because of the monolithic
segment view of the profiling hash.  Check the archives for a discussion
on this and possible work arounds if you are interested.

>On linux, it is possible to save and set the virtual timer upon creation
>of each thread, and thereby get a decent profile.
>However the virtual timer is unavailable on cygwin, and I would imagine
>that this approach is incorrect, due to differing thread models.
>
I've never profiled on Linux and I don't know anything about the virtual
timer you are refering to.  On Solaris, I get a nice flat profile of all
threads combined, like the implimentation I suggested above.  The same
shared library concerns exist there, but Solaris is good about providing
static profile enabled libs.

Let me know if you want to discuss patch ideas.  I used to have a few, but
no priority time to work on them. :(

-- 
Brian Ford
Senior Realtime Software Engineer
VITAL - Visual Simulation Systems
FlightSafety International
Phone: 314-551-8460
Fax:   314-551-8444

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


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