コード例 #1
0
ファイル: CpuUsage.cs プロジェクト: flyeven/Utility
 /// <summary>
 /// 构造函数
 /// </summary>
 public CpuInfo()
 {
     try
     {
         m_cpu = CpuUsage.Create();
     }
     catch { }
 }
コード例 #2
0
ファイル: CpuUsage.cs プロジェクト: flyeven/Utility
 /// <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)
         {
             if (Environment.Is64BitOperatingSystem)
                 m_CpuUsage = new CpuUsageNt_64Bit();
             else
                 m_CpuUsage = new CpuUsageNt();
         }
         else
             throw new NotSupportedException();
     }
     return m_CpuUsage;
 }