3

I am wondering specifically about the "Process/% Processor Time" counter. If you set it to an interval of say 10 seconds, are the data points a snapshot of what the CPU utilization is at that 10 second interval, or an average of the utilization over the past 10 seconds? It would seem to be to naturally be the former, not the latter, but there has been some confusion amongst myself and my colleagues and I wanted to clarify.

Snow Doggy
  • 33
  • 2

1 Answers1

1

Both. :)

Some things like available MB on a disk would be a snapshot - no reason to average that.

However, things like processor performance are "cooked" using a "cookingtype" or formula. So, basically it's an average. http://msdn.microsoft.com/en-us/library/aa392761%28VS.85%29.aspx

I had to write something that took the raw performance counters at two intervals, then did some math based on time between. You won't get the same values as you see in perfmon without doing the math based on time - so it's a average.

You can search MSDN for which formula governs the raw performance data of the thing you're loking for (net utilization, proc perf, etc.) for what you want, and see the cookingtype for it - to seal your debate with your colleagues.

http://msdn.microsoft.com/en-us/library/ms974615.aspx

Excerpt from the article:

Here's the actual formula for PERF_COUNTER_COUNTER:

(CounterValue2 - CounterValue1) / ((TimeValue2 - TimeValue1) / TimeBase)
Matt
  • 1,903
  • 13
  • 12
  • I see what you mean, that does sort of negate the usefulness (with such a cooking type) to some degree of the sampling interval, does it not? – Snow Doggy Sep 30 '10 at 17:27
  • In a way, but if you are truly concerned with the closest value of the second you can always shorten the interval to a millisecond or less. :) Problem is you'll see random spikes throughout the OS. When you open up some app you'll see CPU spike to 99 for a second or two - but realistically you don't want to send an alarm that your machine is running at 99% CPU usage just cause you sampled that very instant. – Matt Sep 30 '10 at 17:36
  • I agree, so it seems that in the cases where the data points are not raw, but cooked, setting the sampling rate (in perfmon) to a higher number will actually produce more less noisy data, in certain cases. – Snow Doggy Sep 30 '10 at 17:51