|
|
|
date: Wed, 16 Apr 2008 01:13:00 -0700,
group: microsoft.public.win32.programmer.wmi
back
Wrong CPU percentage
Hello,
We are working on the calculation of the CPU %, for this purpose we use a
query to obtain the values of the class WMI
Win32_PerfRawData_PerfOS_Processor. Those values are the PercentProcessorTime
and Timestamp_syn10n, with which we carry out the calculation.
For the calculation be made a subtraction between the current value of
PercentProcessorTime and above of this formulation:
100 * (1 â (N2-N1)/(T2-T1))
Where N2 is Current PercentProcessorTime,
N1 is Previous PercentProcessorTime,
T2 is Current Timestamp_syn10n,
T1 is Previous Timestamp_syn10n.
First a question: We know that the values of the variable
PercentProcessorTime are cumulative, we might want to know the behaviour if
we continue monitoring the computer indefinitely because in some time the
values will be reset. The question is: Which are the maximum?. Furthermore,
we have noticed that after starting the computer the first retrived value
seems not starting from zero. Which is the minimum value?
Now a wrong behaviour: In some tests we retrieve some strange values (in
random measurements) when monitoring two computers. For example, monitoring a
computer every 60 seconds we sometimes get this kind of values:
Current PercentProcessorTime: 2134687500, (UINT64)
Previous PercentProcessorTime: 555334062500, (UINT64)
Subtraction: -5.531994e+011, (long double)
Current Timestamp_syn10n: 128523767044700060, (UINT64)
Previous Timestamp_syn10n: 128523757912265245, (UINT64)
Subtraction: 9.132435e+009,(long double)
Result CPU is: 5900% (Int)
As you can see, the previous value is much greater than the current one.
This should be impossible but it happens (we donât know how to reproduce this
problem because this happens 1 or 2 times a day).
The machine where we obtain the data it is a machine with Dual Processor
with Windows XP sp2 operating system (Spanish version). Did you know this
bug (because I suppose this is a bug)? Any ideas about what can look for to
give you more information about the âbugâ?
Regards,
Tango
date: Wed, 16 Apr 2008 01:13:00 -0700
author: Tango am
|
|