PerformanceCounter reporting higher CPU usage than what's observed

后端 未结 1 804
深忆病人
深忆病人 2020-12-07 03:53

I\'m currently doing this:

PerformanceCounter cpuUsage = new PerformanceCounter(\"Processor\", \"% Processor Time\", \"_Total\");
cpuUsage.NextValue();
Syste         


        
相关标签:
1条回答
  • 2020-12-07 04:26
      new PerformanceCounter("Processor", ...);
    

    You are using the wrong counter if you insist on seeing an exact match with Task Manager or Perfmon. Use "Processor Information" instead of "Processor". The reason these counters show different values is addressed pretty well in this blog post. Which counter is "right" is a question I wouldn't want to touch with a ten-foot pole :)

    0 讨论(0)
提交回复
热议问题