Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.performancecounter.aspx" rel="nofollow">PerformanceCounter</a> allows you to query for processor usage.</p> <p>However ,have you tried something the framework provides?</p> <pre><code> foreach (var file in files) { var workitem = file; Task.Factory.StartNew(() =&gt; { // do work on workitem }, TaskCreationOptions.LongRunning | TaskCreationOptions.PreferFairness); } </code></pre> <p>You can tune the concurrency level for Tasks in the Task.<a href="http://msdn.microsoft.com/en-us/library/ee789351.aspx" rel="nofollow">Factory</a>.</p> <p>The .NET 4 threadpool by default will schedule the number of threads it finds most performing on the hardware where it runs, but you can change how that works with the previous link.</p> <p>Probably you need a custom solution but it would be ok to benchmark yours with the standard.</p> <p>Edit: (comment note):</p> <p>No links needed, I may have used an invented term since english is not my language. What I mean is: have a variable where you store the variance before the last check (prevDelta), and call it delta. add this to the varuiable avrageDelta and divide by 2, each time you 'check'. You will have the variable averageDelta that will mostly be low since you have no activity. Then have another set of delta variables, one you have already (delta - prevdelta), and store it in a delta variable that is not the average of all deltas but the average of deltas in a small timespan (you will have to come up with an algortihm to calculate accurately this temporal variance). Once done this you can compare the average delta and the 'temporal delta'. The average delta will be mostly low and will slowly go up whjen bursts come. In the same period the temporal delta will go up really fast. Then you have the situation when the burst stops, the average delta goes slowly down, and the 'temporal' goes really fast.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload