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