Beispiel #1
0
 /// <summary>
 /// 获取内存使用情况
 /// </summary>
 /// <returns></returns>
 public static float GetRAMCounter()
 {
     try
     {
         SystemInfomationHelper.InitCounter();
         return(ram.NextValue() / 1024 / 1024);
     }
     catch
     {
         return(0);
     }
 }
Beispiel #2
0
 /// <summary>
 /// 获取CPU使用情况
 /// </summary>
 /// <returns></returns>
 public static float GetCPUCounter()
 {
     try
     {
         SystemInfomationHelper.InitCounter();
         return(cpu.NextValue());
     }
     catch
     {
         return(0);
     }
 }