繁体   English   中英

在C#中获取特定服务的CPU使用率

[英]Getting CPU usage of a specific Service in C#

我想知道C#中特定服务的CPU使用率。

PerformanceCounter适用于进程:

PerformanceCounter counter = new PerformanceCounter("Process", "% Processor Time", "myprocess", true);  
double result = counter.NextValue();

但没有服务:

   PerformanceCounter counter = new PerformanceCounter("Service", "% Processor Time", "myservice", true);  
    double result = counter.NextValue();

性能计数器的正确名称是

PerformanceCounter counter = new PerformanceCounter("Process", "% Processor Time", "ACService", true);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM