【发布时间】:2014-04-30 14:55:28
【问题描述】:
我目前正在这样做:
PerformanceCounter cpuUsage = new PerformanceCounter("Processor", "% Processor Time", "_Total");
cpuUsage.NextValue();
System.Threading.Thread.Sleep(1000);
RV = cpuUsage.NextValue();
我会定期调用该函数以获取 CPU 使用率。当我在 TaskManager 中监控系统时,PerformanceCounter 报告的 CPU 使用率始终比 TaskManager 报告的高 15-20%(TaskManager 中的 30% = PerformanceCounter 中的 50%)。
也许我忽略了一些文档,但有人解释一下吗?也许它检查时的 CPU 使用率更高,任务管理器报告平均值?
【问题讨论】:
标签: c# cpu-usage performancecounter