Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

为啥这个显示的数据和任务管理器不一样 #2

Closed
PikachuHy opened this issue Feb 23, 2019 · 7 comments
Closed

为啥这个显示的数据和任务管理器不一样 #2

PikachuHy opened this issue Feb 23, 2019 · 7 comments

Comments

@PikachuHy
Copy link

我跑起来后和任务管理器对比,发现任务管理器的数据小一些
我的环境: windows10 msvc
mark

@188080501
Copy link
Owner

这应该是之前修改改错了,统计到当前进程CPU占用率了,我去修复下

@188080501
Copy link
Owner

对比了一些网上Demo,使用方法差不多,暂时没找到问题所在。后面再尝试解决

@PikachuHy
Copy link
Author

OK, 麻烦你了

@HaiLongEmb
Copy link

你好,请问我编译的时候提示如下错误,jqcpumonitor.cpp:75: error: 'class QList<QPair<long long int, double> >' has no member named 'rbegin' 我使用的QT5,QList中没有rbegin,代码逻辑还没有完全看懂,有替换这个方法吗?

@188080501
Copy link
Owner

188080501 commented Feb 10, 2020

我尝试使用了PDH(\Processor(_Total)\% Processor Time),也存在和任务管理器对不上的问题
但是PDH和自己算的是对的上

@188080501
Copy link
Owner

188080501 commented Feb 10, 2020

https://www.itdaan.com/blog/2017/12/04/6766e58052fe23709847fd1824b27d3f.html
https://bbs.csdn.net/topics/392292984
有查询到类似情况,看起来这段代码在win7应该是正常的(但是我没测试过),win10有问题

@188080501
Copy link
Owner

188080501 commented Feb 10, 2020

截屏2020-02-10下午8 34 57
我搜索了几个资料,综合的来看,目前程序里面计算的不是100%正确但是也非错误。我在40线程的cpu上死循环跑了37线程。理论上无法使用全部的cpu但是任务管理器一致提示100%。资源监视器里面却是93%和程序计算值一致。总和却是121%甚至突破了100%
我推测对不上的原因是cpu的128%最大频率,也就是说任务管理器显示的是这个cpu理论性能的百分比,根据频率高低,总和会高于或者低于100%,但是本身显示又有100%上限问题。
而程序里计算的是cpu实际性能的使用率,更为准确。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants