From 0fa7d42cb13a775f6aac0be60b8f3c0d5cb4d668 Mon Sep 17 00:00:00 2001 From: e4BdSBmUzHowFico5Ktn <2YkO3fOdZD@posteo.net> Date: Sun, 12 Jan 2020 07:04:24 +0000 Subject: [PATCH] set_powersave performance enhancement (#28) now set_powersave only turns on turbo boost when all 1m load avg is higher than all available cores instead of 4 cores, this should work better for a broader range of cpus. --- auto-cpufreq.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/auto-cpufreq.py b/auto-cpufreq.py index 8a4016c..d935b09 100755 --- a/auto-cpufreq.py +++ b/auto-cpufreq.py @@ -22,6 +22,7 @@ p = psutil pl = platform s = subprocess tool_run = sys.argv[0] +cpus = os.cpu_count() # get turbo boost state cur_turbo = s.getoutput("cat /sys/devices/system/cpu/intel_pstate/no_turbo") @@ -147,7 +148,7 @@ def set_powersave(): print("Total system load:", load1m, "\n") # conditions for setting turbo in powersave - if load1m > 4: + if load1m > cpus: print("High load, setting turbo boost: on") s.run("echo 0 > /sys/devices/system/cpu/intel_pstate/no_turbo", shell=True) footer(79)