예제 #1
0
파일: CpuUsage.cs 프로젝트: ah906632/brute
 /// <summary>
 /// Creates and returns a CpuUsage instance that can be used to query the CPU time on this operating system.
 /// </summary>
 /// <returns>An instance of the CpuUsage class.</returns>
 /// <exception cref="NotSupportedException">This platform is not supported -or- initialization of the CPUUsage object failed.</exception>
 public static CpuUsage Create()
 {
     if (m_CpuUsage == null) {
         if (Environment.OSVersion.Platform == PlatformID.Win32NT)
             m_CpuUsage = new CpuUsageNt();
         else if (Environment.OSVersion.Platform == PlatformID.Win32Windows)
             m_CpuUsage = new CpuUsage9x();
         else
             throw new NotSupportedException();
     }
     return m_CpuUsage;
 }
예제 #2
0
파일: Form1.cs 프로젝트: ah906632/brute
 private void setupCPULoad()
 {
     try
     {
         cpu = CpuUsage.Create();
         t = new System.Threading.Timer(new TimerCallback(TimerFunction), null, 0, 500);
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }