日期:2014-05-17 浏览次数:21143 次
System.Diagnostics.PerformanceCounter CpuWatch = new System.Diagnostics.PerformanceCounter();//新建一个性能计数器 //设置属性 CpuWatch.CategoryName = "Processor"; CpuWatch.CounterName = "% Processor Time"; CpuWatch.InstanceName = "_Total"; //显示cpu使用率,第二个参数就是取小数点几位,这里取2位 MessageBox.Show(Math.Round(CpuWatch.NextValue(), 2).ToString());
------解决方案--------------------
http://www.codeproject.com/Articles/10258/How-to-get-CPU-usage-of-processes-and-threads看看这个吧 这个好
------解决方案--------------------
http://zhidao.baidu.com/question/328335278.html