From b544393c634cd4332a1e65dfada2505b721aaf8a Mon Sep 17 00:00:00 2001 From: ibrokemypie Date: Fri, 29 Sep 2017 12:13:04 +1000 Subject: [PATCH] modules/sensors: Try intel scaling current frequency On intel pstate drivers only the normal frequency is written to /proc/cpuinfo, not accounting for scaling/turbo. This should fix that, though it needs testing on other computers (AMD, intel without pstate) because I am not certain that the file only exists on Intel pstate. --- bumblebee/modules/sensors.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bumblebee/modules/sensors.py b/bumblebee/modules/sensors.py index 7011ae2..2772dff 100644 --- a/bumblebee/modules/sensors.py +++ b/bumblebee/modules/sensors.py @@ -47,9 +47,13 @@ class Module(bumblebee.engine.Module): return temperature def get_mhz( self ): - output = open("/proc/cpuinfo").read() - m = re.search(r"cpu MHz\s+:\s+(\d+)", output) - mhz = int(m.group(1)) + try: + output = open("/sys/devices/system/cpu/cpufreq/policy0/scaling_cur_freq").read() + mhz = int(float(output)/1000.0) + except: + output = open("/proc/cpuinfo").read() + m = re.search(r"cpu MHz\s+:\s+(\d+)", output) + mhz = int(m.group(1)) if mhz < 1000: return "{} MHz".format(mhz)