Fork me on GitHub

时时获取CPU信息

     static void Main(string[] args)
        {
            PerformanceCounter pc = new PerformanceCounter("Processor", "% Processor Time", "_Total");
            Console.WriteLine(pc.CounterType);
            Console.WriteLine(pc.CounterName);
            Console.WriteLine(pc.CounterHelp);
            while(true)
            {
                Thread.Sleep(TimeSpan.FromSeconds(1));
                float cpuInfo = pc.NextValue();
                Console.WriteLine("cpu当前使用率为{0}",cpuInfo);
            }
            Console.ReadLine();
        }

 更好的文章等着我们去学习http://wsql.iteye.com/blog/1515823

posted @ 2013-05-23 20:28  种花生的读书人  阅读(463)  评论(0编辑  收藏  举报

该博客仅作为记录笔记,转载随意