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

[Win11] psutil.cpu_percent get different result with task manager #2327

Open
Peng-wei-Yu opened this issue Nov 2, 2023 · 4 comments
Open
Labels

Comments

@Peng-wei-Yu
Copy link

Summary

  • OS: { Win11 }
  • Architecture: { 64bit }
  • Psutil version: { 5.9.0 }
  • Python version: { 3.9.15 }
  • Type: { with AMD Ryzen 7 PRO 5850U with Radeon Graphics 1.90 GHz }

Description

import psutil
psutil.cpu_percent(None)
1.2
(here is manually wait 2 seconds around)
psutil.cpu_percent(None)
1.3
(here is manually wait 10 seconds around)
psutil.cpu_percent(None)
1.1
from task manager cpu usage around 7-9%

@Peng-wei-Yu Peng-wei-Yu added the bug label Nov 2, 2023
@moyu284
Copy link

moyu284 commented Nov 22, 2023

I also found the same problem

@RLYRLY
Copy link

RLYRLY commented Apr 17, 2024

Please see this:https://psutil.readthedocs.io/en/latest/#psutil.Process.cpu_percent , it may answer your question.In general, the value calculated on the Windows system needs to be divided by the number of CPU logical cores to be consistent with the value of the task manager.

@kazmorebig
Copy link

kazmorebig commented Jul 3, 2024

Actually this can be reproduced on Intel i7-12700K as well.
@RLYRLY This relates to cpu_present call for a process. If you call this as psutil.cpu_percent (link) value should be close to task manager. However this does not work for Win 11. Anyhow the cpu load reported by psutil should not be lower than the value in task manager, unlike we see here.

@ChiangMark
Copy link

I also encountered this issue with Xeon CPU on Win 11 platform.

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

No branches or pull requests

5 participants