Discussion:
WMI Counters are decreasing!
(too old to reply)
tango
2010-02-24 13:31:02 UTC
Permalink
Raw Message
We have found a problem with some WMI raw performance data counters on
Windows 2003 SP1 and Windows 2003 SP2. We found that some counters decrement,
so each recollection has a lower value that the previous value instead of
getting bigger so this renders the calculations done after the recollection
useless. For example, this happens in Win32_PerfRawData_PerfOS_Processor with
the counter PercentProcessorTime, if we use WBemTest to get the values, we
see that any new value of the counter is lower than the previous one, so when
we try to get a formatted percentage based on the counter values we end
getting an invalid negative percentage of processor time.

Other counters affected are in Win32_PerfRawData_PerfDisk_PhysicalDisk:

- PercentDiskTime
- PercentDiskReadTime
- PercentDiskWriteTime
- AvgDiskQueueLength
- AvgDiskReadQueueLength
- AvgDiskWriteQueueLength

Best regards,

tango
Jialiang Ge [MSFT]
2010-02-25 02:28:57 UTC
Permalink
Raw Message
Hello Tango

Nice to see you again!

To diagnose this problem, I need to first reproduce it on my side. I used
the following vbscript to obtain the current percent processor time on the
local computer and converts it to a percentage. The code is from
http://msdn.microsoft.com/en-us/library/aa392397(VS.85).aspx.

Set objService = GetObject( _
"Winmgmts:{impersonationlevel=impersonate}!\Root\Cimv2")

For i = 1 to 8
Set objInstance1 = objService.Get( _
"Win32_PerfRawData_PerfOS_Processor.Name='_Total'")
N1 = objInstance1.PercentProcessorTime
D1 = objInstance1.TimeStamp_Sys100NS

'Sleep for two seconds = 2000 ms
WScript.Sleep(2000)

Set perf_instance2 = objService.Get( _
"Win32_PerfRawData_PerfOS_Processor.Name='_Total'")
N2 = perf_instance2.PercentProcessorTime
D2 = perf_instance2.TimeStamp_Sys100NS
' Look up the CounterType qualifier for the PercentProcessorTime
' and obtain the formula to calculate the meaningful data.
' CounterType - PERF_100NSEC_TIMER_INV
' Formula - (1- ((N2 - N1) / (D2 - D1))) x 100

PercentProcessorTime = (1 - ((N2 - N1)/(D2-D1)))*100
WScript.Echo "% Processor Time=" , Round(PercentProcessorTime,2)
Next

The test result on my Windows Server 2003 (with the latest SP) is:

% Processor Time= 2.22
% Processor Time= 1.77
% Processor Time= 2.15
% Processor Time= 1.81
% Processor Time= 2.24
% Processor Time= 13.15
% Processor Time= 4.89
% Processor Time= 9.95

Could you please try this on your side too?


Regards,
Jialiang Ge
Microsoft Online Community Support

=================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
=================================================
Crybig
2010-03-10 10:03:01 UTC
Permalink
Raw Message
I have similar problem (Vista Ultimate x64 SP2).
After running that script (a little modified version than above - added 80
steps without Sleep) I got negative % values:

Set objService = GetObject( _
"Winmgmts:{impersonationlevel=impersonate}!\Root\Cimv2")

For i = 1 to 80
Set objInstance1 = objService.Get( _
"Win32_PerfRawData_PerfOS_Processor.Name='_Total'")
N1 = objInstance1.PercentProcessorTime
D1 = objInstance1.TimeStamp_Sys100NS

Set perf_instance2 = objService.Get( _
"Win32_PerfRawData_PerfOS_Processor.Name='_Total'")
N2 = perf_instance2.PercentProcessorTime
D2 = perf_instance2.TimeStamp_Sys100NS
' Look up the CounterType qualifier for the PercentProcessorTime
' and obtain the formula to calculate the meaningful data.
' CounterType - PERF_100NSEC_TIMER_INV
' Formula - (1- ((N2 - N1) / (D2 - D1))) x 100

PercentProcessorTime = (1 - ((N2 - N1)/(D2-D1)))*100
WScript.Echo "% Processor Time=" , Round(PercentProcessorTime,2)
Next

Loading...