Skip to content

Commit

Permalink
Fix cpu_freq (#1493)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbrochart authored and giampaolo committed Apr 25, 2019
1 parent 7ee88af commit 01e00a6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion psutil/_pslinux.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -715,6 +715,12 @@ def cpu_freq():
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
Expand Down

0 comments on commit 01e00a6

Please sign in to comment.