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.
This commit is contained in:
ibrokemypie 2017-09-29 12:13:04 +10:00
parent 08c115dc7d
commit b544393c63

View file

@ -47,6 +47,10 @@ class Module(bumblebee.engine.Module):
return temperature return temperature
def get_mhz( self ): def get_mhz( self ):
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() output = open("/proc/cpuinfo").read()
m = re.search(r"cpu MHz\s+:\s+(\d+)", output) m = re.search(r"cpu MHz\s+:\s+(\d+)", output)
mhz = int(m.group(1)) mhz = int(m.group(1))