7
C#で特定のサービスのCPU使用率を知りたい。サービスとC#で特定のサービスのCPU使用率を取得する
PerformanceCounter counter = new PerformanceCounter("Process", "% Processor Time", "myprocess", true);
double result = counter.NextValue();
ではなく:プロセスと正常に動作しますPerformanceCounter
PerformanceCounter counter = new PerformanceCounter("Service", "% Processor Time", "myservice", true);
double result = counter.NextValue();
サービスがあまりにもプロセスです –
私は"試してみた" PerformanceCounter counter =新しいPerformanceCounter( "Process"、 "%Processor Time"、 "myservice"、true); – userfloflo
サービスのCPU使用率を取得するには double result = counter.NextValue(); "myServiceを使用しないで、実際の名前を使用すると、変更が問題を隠しています –