diff --git a/hwbench/tuning/power_profile.py b/hwbench/tuning/power_profile.py index 9328053..9a9d2e7 100644 --- a/hwbench/tuning/power_profile.py +++ b/hwbench/tuning/power_profile.py @@ -10,15 +10,13 @@ def __init__(self, out_dir): self.out_dir = out_dir self.skip_tuning = False - available_governors = ( - pathlib.Path("/sys/devices/system/cpu/cpuidle/available_governors") + current_governor = ( + pathlib.Path("/sys/devices/system/cpu/cpuidle/current_governor") .read_text("ascii") .strip() .split() ) - self.skip_tuning |= ( - len(available_governors) == 1 and available_governors[0] == "menu" - ) + self.skip_tuning |= current_governor == "menu" def run(self) -> None: log = tunninglog() @@ -29,8 +27,15 @@ def run(self) -> None: for rootpath, dirnames, filenames in os.walk("/sys/devices/system/cpu"): for dirname in dirnames: if pattern.match(dirname): - cpudir = pathlib.Path(rootpath) / dirname - file = cpudir / "cpufreq/scaling_governor" + file = pathlib.Path(rootpath).joinpath( + dirname, "cpufreq", "scaling_governor" + ) + # Ignore this tuning if no scaling_governor available + if not file.exists(): + log.info( + f"skip PerformancePowerProfile for {dirname} as no scaling governor detected" + ) + continue previous = file.read_text(encoding="utf-8").rstrip() # please read https://www.kernel.org/doc/html/latest/admin-guide/pm/cpufreq.html # for more explanation