PerformanceCounter

  • Thread starter Thread starter Sergey
  • Start date Start date
S

Sergey

I'm trying to read values of some counters. Unfortunately
not all of them work properly, for example "Average Disk
Queue" always shows 0, but PerformanceMonitor Console
shows others values.

How can I solve this problem??

Thanks,
Sergey
 
Some counters require multiple samples to be taken in
order to calculate the performance value.
Call NextSample method twice with one second delay and
call Calculate method by passing in those two sample
values.

Check for performance counter type and if it belongs to
any category that requires average values to be taken,
call Calculate method.
e.g.
if
(perfCounter.Type==PerformanceCounterType.Timer100NsInvers
e)
{
//Call Calculate method here.
}
If you find any other counter types other than
Timer100NsInverse that require this type of calculations,
please let me know. I am also looking for documentation
on this.
 
Back
Top