zoukankan      html  css  js  c++  java
  • 获取电脑cpu的使用情况

    using System;
    using System.Diagnostics;
    namespace ConsoleApplication1
    {
        class Program
        {
            static void Main(string[] args)
            {
                PerformanceCounter[] counters = new PerformanceCounter[System.Environment.ProcessorCount];
                for (int i = 0; i < counters.Length; i++)
                {
                    counters[i] = new PerformanceCounter("Processor", "% Processor Time", i.ToString());
                }
    
                while (true)
                {
                    for (int i = 0; i < counters.Length; i++)
                    {
                        float f = counters[i].NextValue();
                        Console.WriteLine("CPU-{0}: {1:f}%", i, f);
                    }
                    Console.WriteLine();
                    System.Threading.Thread.Sleep(1000);
                }
            }
        }
    }

    http://www.cnblogs.com/kevinGao/archive/2011/12/09/2671025.html

    http://www.cnblogs.com/shuncy/archive/2008/11/07/1328738.html

  • 相关阅读:
    类与类之间的关系图
    UML介绍
    数据建模
    状态图
    部署图
    用例图
    业务建模
    时序图
    postgresql 维护手册
    ashx文件的使用(转)
  • 原文地址:https://www.cnblogs.com/lwngreat/p/4873509.html
Copyright © 2011-2022 走看看