Commits
dimir authored 3852a4de19c
...G...... [ZBX-5201] handle perfcounter error PDH_CALC_NEGATIVE_DENOMINATOR
[svn merge ^/branches/2.0 -c r32541]
The counter to calculate rate values such as system.cpu.util shows the
average percentage of active time observed during the sample
interval. This is an inverse counter. Inverse counters are calculated
by monitoring the percentage of time that the service was inactive and
then subtracting that value from 100 percent.
The formula used to calculate the value is:
(1 - (inactive time delta) / (total time delta)) x 100
where delta is a result of subtraction of new value and previous
value.
It's logical to assume that inactive time is always less than or equal
to the total time. For some unknown reason sometimes performance
counter return values in such a way that inactive delta is greater
than total. There must be some kind of bug in how performance counters
work. When this happens the function PdhCalculateCounterFromRawValue()
returns error PDH_CALC_NEGATIVE_DENOMINATOR.
As tests show when this happens the inactive time equals total time
which means zero result.
Before the fix:
- item becames unsupported if performance counter receives "negative
denominator" error
After the fix:
- zero (0.0) is returned and item does not become unsupported if
performance counter receives "negative denominator" error
More info: technet.microsoft.com/en-us/library/cc757283(WS.10).aspx