Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com X-Authentication-Warning: eos.vss.fsi.com: ford owned process doing -bs Date: Thu, 2 Oct 2003 11:54:38 -0500 (CDT) From: Brian Ford X-X-Sender: ford AT eos To: cygwin AT cygwin DOT com Subject: Re: Is multithreaded profiling on cygwin possible? Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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/