-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Fix cpu freq #1496
Fix cpu freq #1496
Conversation
ret.append(_common.scpufreq(float(value), 0., 0.)) | ||
except IOError as err: | ||
raise NotImplementedError( | ||
"%r for file %r" % (err, path)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mmm... Not sure I understand why catching IOError is necessary here. Isn't the function declaration guarded by if os.path.exists("/proc/cpuinfo"):
already?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's because of this test: https://github.com/davidbrochart/psutil/blob/fix_cpu_freq/psutil/tests/test_linux.py#L859-L868
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
psutil/_pslinux.py
Outdated
def cpu_freq(): | ||
"""Dummy implementation when none of the above files are present. | ||
""" | ||
return [_common.scpufreq(0.0, 0.0, 0.0)] * cpu_count_logical() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As per documentation:
If min and max cannot be determined they are set to
0
.
In here we're including current
. We shouldn't do that. Please return an empty list instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean return []
or return [[] for _ in range(cpu_count_logical())]
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return []
I fixed this in c2b333b. That should get you going. |
...and... it turns out I was wrong. =) |
* origin/master: Fix giampaolo#1276: [AIX] use getargs to get process cmdline (giampaolo#1500) (patch by @wiggin15) Fix Process.ionice example using wrong keyword arg (giampaolo#1504) fix history syntax remove catching IOError; let the test fail and adjust it later Fix cpu freq (giampaolo#1496) pre release fix giampaolo#1493: [Linux] cpu_freq(): handle the case where /sys/devices/system/cpu/cpufreq/ exists but is empty. Revert "Fix cpu_freq (giampaolo#1493)" (giampaolo#1495) Fix cpu_freq (giampaolo#1493) Update cpu_freq to return 0 for max/min if not available (giampaolo#1487) give CREDITS to @agnewee for giampaolo#1491 SunOS / net_if_addrs(): free() ifap struct on error (giampaolo#1491) fix giampaolo#1486: add wraps() decorator around wrap_exceptions refactor/move some utilities into _common.py update doc update HISTORY Implement getloadavg on Windows. Fixes giampaolo#604 and giampaolo#1484 (giampaolo#1485) (patch by Ammar Askar) give credits to @amanusk for giampaolo#1472
This should fix the tests.