code format
This commit is contained in:
@@ -123,14 +123,17 @@ def readmsr(msr, from_bit=0, to_bit=63, cpu=None, flatten=False):
|
||||
else:
|
||||
raise e
|
||||
|
||||
|
||||
def get_value_for_bits(val, from_bit=0, to_bit=63):
|
||||
mask = sum(2**x for x in range(from_bit, to_bit + 1))
|
||||
return (val & mask) >> from_bit
|
||||
|
||||
|
||||
def is_on_battery():
|
||||
with open(SYSFS_POWER_PATH) as f:
|
||||
return not bool(int(f.read()))
|
||||
|
||||
|
||||
def get_cpu_platform_info():
|
||||
features_msr_value = readmsr(0xce, cpu=0)
|
||||
cpu_platform_info = {}
|
||||
@@ -302,8 +305,7 @@ def power_thread(config, regs, exit_event):
|
||||
thermal_status = get_reset_thermal_status()
|
||||
for index, core_thermal_status in enumerate(thermal_status):
|
||||
for key, value in core_thermal_status.items():
|
||||
print('[D] core {} thermal status: {} = {}'.format(
|
||||
index, key.replace("_", " "), value))
|
||||
print('[D] core {} thermal status: {} = {}'.format(index, key.replace("_", " "), value))
|
||||
|
||||
# switch back to sysfs polling
|
||||
if power['method'] == 'polling':
|
||||
@@ -377,8 +379,7 @@ def main():
|
||||
platform_info = get_cpu_platform_info()
|
||||
if args.debug:
|
||||
for key, value in platform_info.items():
|
||||
print('[D] cpu platform info: {} = {}'.format(
|
||||
key.replace("_", " "), value))
|
||||
print('[D] cpu platform info: {} = {}'.format(key.replace("_", " "), value))
|
||||
regs = calc_reg_values(platform_info, config)
|
||||
|
||||
if not config.getboolean('GENERAL', 'Enabled'):
|
||||
|
||||
Reference in New Issue
Block a user