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 @   种花生的读书人  阅读(466)  评论(0编辑  收藏  举报
努力加载评论中...

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

点击右上角即可分享
微信分享提示