summaryrefslogtreecommitdiff
path: root/psutil/_pslinux.py
diff options
context:
space:
mode:
authorDavid Brochart <david.brochart@gmail.com>2019-04-25 06:29:25 +0200
committerGiampaolo Rodola <g.rodola@gmail.com>2019-04-25 12:29:25 +0800
commit01e00a6629a78a7277aac627c8b025cb753d6fee (patch)
tree7ff0c1fd707489941b58457aa1ea9265170265b9 /psutil/_pslinux.py
parent7ee88afd9f6730289cf9e34f70210fdb387b8a71 (diff)
downloadpsutil-01e00a6629a78a7277aac627c8b025cb753d6fee.tar.gz
Fix cpu_freq (#1493)
Diffstat (limited to 'psutil/_pslinux.py')
-rw-r--r--psutil/_pslinux.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/psutil/_pslinux.py b/psutil/_pslinux.py
index 4c973c2d..ac45b54b 100644
--- a/psutil/_pslinux.py
+++ b/psutil/_pslinux.py
@@ -668,7 +668,7 @@ def cpu_stats():
ctx_switches, interrupts, soft_interrupts, syscalls)
-if os.path.exists("/sys/devices/system/cpu/cpufreq") or \
+if os.path.exists("/sys/devices/system/cpu/cpufreq/policy0") or \
os.path.exists("/sys/devices/system/cpu/cpu0/cpufreq"):
def cpu_freq():
"""Return frequency metrics for all CPUs.
@@ -715,6 +715,12 @@ elif os.path.exists("/proc/cpuinfo"):
ret.append(_common.scpufreq(float(value), 0.0, 0.0))
return ret
+else:
+ def cpu_freq():
+ """Dummy implementation when none of the above files are present.
+ """
+ return []
+
# =====================================================================
# --- network