如何获得超过2核心的CPU使用率? [英] How to get CPU usage for more than 2 cores?

查看:194
本文介绍了如何获得超过2核心的CPU使用率?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试着在我的程序的CPU使用率由核分就搞定了。现在,我使用的PerformanceCounter
和改变0和1之间的实例名我有数据从2芯

I try to get in my program CPU usage divided by a cores. Now I use the PerformanceCounter and changing the InstanceName between 0 and 1 I have the data from 2 cores.

PerformanceCounter pc0 = new PerformanceCounter("Processor", "% Processor Time", "0");
PerformanceCounter pc1 = new PerformanceCounter("Processor", "% Processor Time", "1");

我怎样才能获得第三名核心使用,第4核等。

How I can get core usage for 3rd, 4th core etc.?

有没有人能帮助我吗?

感谢

推荐答案

我还没有使用的PerformanceCounter之前,但有什么错这样做呢?

I havent used PerformanceCounter before but is there something wrong with doing this?

PerformanceCounter pc0 = new PerformanceCounter("Processor", "% Processor Time", "0");
PerformanceCounter pc1 = new PerformanceCounter("Processor", "% Processor Time", "1");
PerformanceCounter pc2 = new PerformanceCounter("Processor", "% Processor Time", "2");
PerformanceCounter pc3 = new PerformanceCounter("Processor", "% Processor Time", "3");

这篇关于如何获得超过2核心的CPU使用率?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆