Thursday, June 6, 2013

Calculating Processor(_Total)\%Processor Time For System Using Process(*)\%Processor Time Performance Counter

Before going to detailed description on this topic, I would like to start it with a question...!!!!"Can we calculate %Processor Time for the System which has multi-core processor if Processor(_Total)\%Processor Time counter is not included in the Perfmon?" [Also, provided we have all the necessary counters for the Process Object in the Perfmon, for e.g. Process(*)\%Processor Time is included]

Any Guess...!!!!!
Let me tell you how we can do this using the Process(*)\%Processor Time counters for the Process Object.
We can do this by using the following formula which will reflect exactly the same values for the Processor Counter [i.e. Processor(_Total)\%Processor Time]
Use the below formula:
Processor(_Total)\%Processor Time =[Process(_Total)\% Processor Time - Process(Idle)\% Processor Time]/Number Of Cores

Considering Process(_Total)\% Processor Time = Number_Of_Cores * 100

Bit confusing..????
Let me explain you with some example which will give you more understanding on this measurement.
Consider the below raw data which I have from the Perfmon utility every 1 second. I have considered here only 3 performance counters to make you understand:
1. Process(_Total)\% Processor Time
2. Process(Idle)\% Processor Time
3. Processor(_Total)\% Processor Time

Process(_Total)\ % Processor Time  Process(Idle)\ % Processor Time
194.7602101 113.7708158
199.68128 174.72112
196.5612 170.04109
198.12127 174.72112

Processor(_Total)\% Processor Time
43.11458591
12.63944
14.97946
12.63944

Descriptions:
I have a Dual-Core machine, so let me consider the column \\MachineName\Process(_Total)\% Processor Time to evaluate it's values as:

\\MachineName\Process(_Total)\% Processor Time = 2 x 100 = 200 [So we can consider column values of this counter as 200 instead of 194.7602101, 199.68128 and so (this is nothing but the value 100% for each cores).

So, now let me calculate the Processor(_Total)\% Processor Time with the available Process related data.
e.g.
Processor(_Total)\% Processor Time = [200 - 113.7708158]/2
= 43.1145921 (which is almost equal to what it is shown in the third column of the Perfmon result i.e. equal to column values MachineName\Processor(_Total)\% Processor Time)

This explains the procedure to calculate the Processor(_Total)\% Processor Time if in case only Process counters are included in the Perfmon Utility.

No comments: