Profiling Parallel.ForEach
GSchroder
Posts: 4
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
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
Comments
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!
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?
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.