Search code examples
c#-4.0wmiperformancecounterwmi-queryperfmon

Issue with perfmon counter value using WMI query


I am building EXE and through which i am fetching perfmon counter of application to monitor that using WMI query. I am testing it with my local machine and seems like my code logic gives me incorrect values for some of counters.

Below is my code for one of the counter (CacheTotalHitRatio) enter image description here

And when i have looked it with perfmon exe in my system then it shows me something different as shown below.

enter image description here

I think CacheTotalHitRatio is in percentage and should not be go beyond 100 but my code gives some higher value. What is problem here OR am i doing something wrong here?

Please let me know if anyone have experience with WMI query.

Thanks in Advance.


Solution

  • Exist two types of Performance Counter Classes

    The Win32_PerfRawData_ASPNET_ASPNETApplications class returns the raw performance counter values these values must be transformed (using a formula according to the property and the class) to be displayed, if you uses the Win32_PerfFormattedData_ASPNET_ASPNETApplications class instead you will get the calculated data just as are shown in the Performance monitor.