Thread: [GD-General] profiling multi threaded applications
Brought to you by:
vexxed72
From: Andras B. <and...@gm...> - 2005-07-20 14:35:48
|
I was about to add a simple profiler into our engine, but I've just realized that the usual hierarchical profiler that measures the time for a chunk of code won't cut it, in a multithreaded application. I understand that even when I have a single threaded app, there are usually several other applications are running in the background, but mostly they are all idle, so it's just noise. But in this case, I would have multiple, heavily working threads. If the OS switches back and forth between these threads all the time, then how is it possible to make accurate, or even just usable measurements?? Thanks, Andras |
From: Christian L. <cla...@fe...> - 2005-07-20 15:32:48
|
If possible, design your architecture so that your threads can work in a lockstep mode, with one central mutex controlling which thread is running at any given moment. That way you can at least get a partial profile and optimize each thread individually. This type of design can also prove very useful to debug deadlocks. Hope that helps a bit, Christian Laforte www.feelingsoftware.com > -----Original Message----- > From: gam...@li... > [mailto:gam...@li...] On Behalf Of > Andras Balogh > Sent: Wednesday, July 20, 2005 10:36 AM > To: gam...@li... > Subject: [GD-General] profiling multi threaded applications > > I was about to add a simple profiler into our engine, but I've just > realized that the usual hierarchical profiler that measures the time for > a chunk of code won't cut it, in a multithreaded application. > > I understand that even when I have a single threaded app, there are > usually several other applications are running in the background, but > mostly they are all idle, so it's just noise. But in this case, I would > have multiple, heavily working threads. If the OS switches back and > forth between these threads all the time, then how is it possible to > make accurate, or even just usable measurements?? > > Thanks, > > Andras > > > ------------------------------------------------------- > SF.Net email is sponsored by: Discover Easy Linux Migration Strategies > from IBM. Find simple to follow Roadmaps, straightforward articles, > informative Webcasts and more! Get everything you need to get up to > speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click > _______________________________________________ > Gamedevlists-general mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-general > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_id=557 |
From: Andras B. <and...@gm...> - 2005-07-20 18:37:47
|
Pretending that this is not an option, are there any other possibilities? Christian Laforte wrote: > If possible, design your architecture so that your threads can work in a > lockstep mode, with one central mutex controlling which thread is running at > any given moment. That way you can at least get a partial profile and > optimize each thread individually. > > This type of design can also prove very useful to debug deadlocks. > > Hope that helps a bit, > > Christian Laforte > www.feelingsoftware.com > > >>-----Original Message----- >>From: gam...@li... >>[mailto:gam...@li...] On Behalf Of >>Andras Balogh >>Sent: Wednesday, July 20, 2005 10:36 AM >>To: gam...@li... >>Subject: [GD-General] profiling multi threaded applications >> >>I was about to add a simple profiler into our engine, but I've just >>realized that the usual hierarchical profiler that measures the time for >>a chunk of code won't cut it, in a multithreaded application. >> >>I understand that even when I have a single threaded app, there are >>usually several other applications are running in the background, but >>mostly they are all idle, so it's just noise. But in this case, I would >>have multiple, heavily working threads. If the OS switches back and >>forth between these threads all the time, then how is it possible to >>make accurate, or even just usable measurements?? >> >>Thanks, >> >>Andras |
From: brian s. <bri...@gm...> - 2005-07-20 18:58:48
|
You could set the thread priority to maximum for the thread you're=20 interested in. Do it at the start of your profiling block - that will prett= y=20 much starve the other threads for the bit you want to profile - and then=20 undo it at the end.=20 This is, of course, assuming we're talking about a platform that allows suc= h=20 things. =20 --brian On 7/20/05, Andras Balogh <and...@gm...> wrote: >=20 > Pretending that this is not an option, are there any other possibilities? >=20 >=20 > Christian Laforte wrote: > > If possible, design your architecture so that your threads can work in = a > > lockstep mode, with one central mutex controlling which thread is=20 > running at > > any given moment. That way you can at least get a partial profile and > > optimize each thread individually. > > > > This type of design can also prove very useful to debug deadlocks. > > > > Hope that helps a bit, > > > > Christian Laforte > > www.feelingsoftware.com <http://www.feelingsoftware.com> > > > > > >>-----Original Message----- > >>From: gam...@li... > >>[mailto:gam...@li...] On Behalf Of > >>Andras Balogh > >>Sent: Wednesday, July 20, 2005 10:36 AM > >>To: gam...@li... > >>Subject: [GD-General] profiling multi threaded applications > >> > >>I was about to add a simple profiler into our engine, but I've just > >>realized that the usual hierarchical profiler that measures the time fo= r > >>a chunk of code won't cut it, in a multithreaded application. > >> > >>I understand that even when I have a single threaded app, there are > >>usually several other applications are running in the background, but > >>mostly they are all idle, so it's just noise. But in this case, I would > >>have multiple, heavily working threads. If the OS switches back and > >>forth between these threads all the time, then how is it possible to > >>make accurate, or even just usable measurements?? > >> > >>Thanks, > >> > >>Andras >=20 >=20 > ------------------------------------------------------- > SF.Net email is sponsored by: Discover Easy Linux Migration Strategies > from IBM. Find simple to follow Roadmaps, straightforward articles, > informative Webcasts and more! Get everything you need to get up to > speed, fast. http://ads.osdn.com/?ad_id=3D7477&alloc_id=3D16492&op=3Dclic= k > _______________________________________________ > Gamedevlists-general mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-general > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_id=3D557 >=20 > |
From: Mick W. <de...@mi...> - 2005-07-20 19:06:04
|
Thread Profilers do exist, (not that I've used one): http://www.intel.com/cd/software/products/asmo-na/eng/threading/tp/index.htm What platform is this for? Mick. Andras Balogh wrote: > Pretending that this is not an option, are there any other possibilities? > > > Christian Laforte wrote: > >> If possible, design your architecture so that your threads can work in a >> lockstep mode, with one central mutex controlling which thread is >> running at >> any given moment. That way you can at least get a partial profile and >> optimize each thread individually. >> >> This type of design can also prove very useful to debug deadlocks. >> >> Hope that helps a bit, >> >> Christian Laforte >> www.feelingsoftware.com >> >>> -----Original Message----- >>> From: gam...@li... >>> [mailto:gam...@li...] On Behalf Of >>> Andras Balogh >>> Sent: Wednesday, July 20, 2005 10:36 AM >>> To: gam...@li... >>> Subject: [GD-General] profiling multi threaded applications >>> >>> I was about to add a simple profiler into our engine, but I've just >>> realized that the usual hierarchical profiler that measures the time >>> for >>> a chunk of code won't cut it, in a multithreaded application. >>> >>> I understand that even when I have a single threaded app, there are >>> usually several other applications are running in the background, but >>> mostly they are all idle, so it's just noise. But in this case, I would >>> have multiple, heavily working threads. If the OS switches back and >>> forth between these threads all the time, then how is it possible to >>> make accurate, or even just usable measurements?? >>> >>> Thanks, >>> >>> Andras >> > > > ------------------------------------------------------- > SF.Net email is sponsored by: Discover Easy Linux Migration Strategies > from IBM. Find simple to follow Roadmaps, straightforward articles, > informative Webcasts and more! Get everything you need to get up to > speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click > _______________________________________________ > Gamedevlists-general mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-general > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_id=557 > |
From: Andras B. <and...@gm...> - 2005-07-20 19:55:50
|
The platform is Win32, and I'd prefer using an embedded profiler in the engine, not an external one. I can play around with the thread priorities and such, I just hoped that there is a "generic" solution to this problem that I missed.. Thanks, Andras Mick West wrote: > Thread Profilers do exist, (not that I've used one): > > http://www.intel.com/cd/software/products/asmo-na/eng/threading/tp/index.htm > > > What platform is this for? > > Mick. > > > Andras Balogh wrote: > >> Pretending that this is not an option, are there any other possibilities? >> >> >> Christian Laforte wrote: >> >>> If possible, design your architecture so that your threads can work in a >>> lockstep mode, with one central mutex controlling which thread is >>> running at >>> any given moment. That way you can at least get a partial profile and >>> optimize each thread individually. >>> >>> This type of design can also prove very useful to debug deadlocks. >>> >>> Hope that helps a bit, >>> >>> Christian Laforte >>> www.feelingsoftware.com >>> >>>> -----Original Message----- >>>> From: gam...@li... >>>> [mailto:gam...@li...] On Behalf Of >>>> Andras Balogh >>>> Sent: Wednesday, July 20, 2005 10:36 AM >>>> To: gam...@li... >>>> Subject: [GD-General] profiling multi threaded applications >>>> >>>> I was about to add a simple profiler into our engine, but I've just >>>> realized that the usual hierarchical profiler that measures the time >>>> for >>>> a chunk of code won't cut it, in a multithreaded application. >>>> >>>> I understand that even when I have a single threaded app, there are >>>> usually several other applications are running in the background, but >>>> mostly they are all idle, so it's just noise. But in this case, I would >>>> have multiple, heavily working threads. If the OS switches back and >>>> forth between these threads all the time, then how is it possible to >>>> make accurate, or even just usable measurements?? >>>> >>>> Thanks, >>>> >>>> Andras |