Profiling Parallel.ForEach

Code profiling for .NET developers.

Moderators: AndrewH, melvyn.harbour, james.billings, Laura Morley, dene.boulton

Profiling Parallel.ForEach

Postby GSchroder » Wed Jan 30, 2013 10:45 am

I have noticed when profiling my app all my systems cores are not utilized when using a Parallel.ForEach. When I run the app from VS 2012 they do as expected, but not when profiling?
I am profiling it using the ASP.NET web application (web development server) option (.NET 4). Only thing that's different is the profiler seems to use VS 2010 web dev server, whereas I'm using VS 2012. This shouldn't make a difference though
GSchroder
 
Posts: 3
Joined: Wed Jan 30, 2013 10:36 am

Postby Chris.Allen » Thu Jan 31, 2013 2:37 pm

ANTS uses ThreadAffinity which helps it co-ordinate clock ticks for all threads.

If you want to utilise more cores (and will accept a certain amount of uncertainty on the results), locate your settings file :
%USERPROFILE%\\AppData\\Local\\Red GateANTS Performance Profiler 7\\PerformanceProfilerSettings.xml

and set ThreadAffinity to false.

<property name="UseThreadAffinity"> <object type="System.Boolean">False</object> </property>

and retry

Please let me know if that helps!
Chris.Allen
 
Posts: 594
Joined: Thu Mar 12, 2009 4:17 pm

Re:

Postby GSchroder » Thu Jan 31, 2013 3:18 pm

Chris.Allen wrote:If you want to utilise more cores (and will accept a certain amount of uncertainty on the results)


Thanks for the reply. What exactly do you mean by a certain amount of uncertainty? The timing could be off between cores leading to some execution times possibly being inaccurate? And ballpark what sort of amount are we talking here?
GSchroder
 
Posts: 3
Joined: Wed Jan 30, 2013 10:36 am

Postby Chris.Allen » Thu Feb 07, 2013 3:11 pm

>> The timing could be off between cores leading to some execution times possibly being inaccurate?

Precisely. Apparently, clocks aren't synched between cores and no correction is made for this.


>>And ballpark what sort of amount are we talking here?

I'd say between 5 and 10% but there's bound to be pathological cases.
I'd run both sessions (with and without affinity). Trust *percentage* values for ThreadAffinity = true; trust absolute and real-world performance values for ThreadAffinity = false.

And if there's major discrepancies between the two, be sceptical about specific ThreadAffinity = false values.

Profiling is more of an art than a science.
Chris.Allen
 
Posts: 594
Joined: Thu Mar 12, 2009 4:17 pm

Postby GSchroder » Fri Feb 08, 2013 8:37 am

All makes sense, thanks for the response Chris
GSchroder
 
Posts: 3
Joined: Wed Jan 30, 2013 10:36 am


Return to ANTS Performance Profiler 7

Who is online

Users browsing this forum: No registered users and 0 guests

cron