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

psuilt.cpu_freq(percpu=True) may not return all CPUs on linux #1269

Closed
andrewjcg opened this issue Apr 20, 2018 · 5 comments
Closed

psuilt.cpu_freq(percpu=True) may not return all CPUs on linux #1269

andrewjcg opened this issue Apr 20, 2018 · 5 comments

Comments

@andrewjcg
Copy link

The implementation for cpu_freq for linux (in _pslinux.py) parses the policy files under /sys/devices/system/cpu/cpufreq/policy* and assumes there's a one-to-one mapping from these to online CPUs. However, it may be the case that a single policy applies to multiple online CPUs, in which case these CPUs will be listed in /sys/devices/system/cpu/cpufreq/policy*/affected_cpus and a separate policy for this CPU may not be listed (https://www.kernel.org/doc/html/v4.14/admin-guide/pm/cpufreq.html#policy-interface-in-sysfs).

This can cause the psutil.tests.test_system.TestSystemAPIs.test_cpu_freq test to fail.

@giampaolo
Copy link
Owner

What action do you propose? I'm not sure I understand the problem enough to have a solution.

@andrewjcg
Copy link
Author

I think the code that parses these might also need to parse /sys/devices/system/cpu/cpufreq/policy*/affected_cpus to find the cpu # that the policy applies to, rather than relying on the # found in policy*.

@amanusk
Copy link
Collaborator

amanusk commented Apr 11, 2019

@giampaolo, @andrewjcg, does #1481 fix this?

@giampaolo
Copy link
Owner

Mmm I think yes but I'm not sure. This ticket talks about a failing psutil.tests.test_system.TestSystemAPIs.test_cpu_freq. @andrewjcg's does it still fail with latest master?

@no-response
Copy link

no-response bot commented Jan 12, 2021

This issue has been automatically closed because there has been no response for more information from the original author. Please reach out if you have or find the answers requested so that this can be investigated further.

@no-response no-response bot closed this as completed Jan 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants