# How to calc average Cpu utilization by process's "%processor time" counter with CPU affinity

### Frage

• Hi All,

Now i'm working on a windows project and encountered below problem.

Details

System are with 32 Cpus. And for my process "aaa",  i made Cpu affinty on it with CPU0,1.

Then running some script stress on process "aaa".

I record the counter data for process "aaa"'s "%processor time" for about 1 min by every 30/sec

%processor time

190

199

Then i calculate the average Cpu utilization for process "aaa" as (190+199)/2 /2 = 97.25

So i thought the average Cpu utilization for Cpu0 and Cpu1 is about 97.25% (For process "aaa" there was only 2 Cpu System)

But some person in my team said my calculation is wrong and should be (190+199)/2 / 32 = 6.0

6.0 is the total Cpu utilization of process "aaa"

So here is the problem which one is correct?

Thanks for helping on this!

Best Regards

Martin Liao

• Bearbeitet Montag, 27. Februar 2012 04:05
Montag, 27. Februar 2012 04:04

### Alle Antworten

• This is not an easy value to get out of perfmon.  This is the way it has been explained to me.

Assume 1 CPU here.

First you need to know Processor\% User Time\_total value.

The amount of CPU you are using is (Processor\% User Time\_total)*(Process\% Processor time\(your application))

For example Processor\% User Time\_total averaged 25%

Process\% Processor time\(your application) = 50%