コード例 #1
0
 public override Task <double> CpuUsage()
 {
     return(Task.Run(() =>
     {
         return Math.Round(CpuCounter.NextValue());
     }));
 }
コード例 #2
0
 private static double CpuUsage()
 {
     if (CpuCounter == null)
     {
         CpuCounter = new PerformanceCounter("Processor", "% Processor Time", "_Total");
     }
     return(Math.Round(CpuCounter.NextValue()));
 }