turbo trigger revamp, use more conservative settings (#109, #118)

This commit is contained in:
Adnan Hodzic 2020-09-17 22:16:37 +02:00
parent 70c646f9cb
commit 5223e6e3bc
1 changed files with 19 additions and 11 deletions

View File

@ -36,6 +36,10 @@ load1m, _, _ = os.getloadavg()
# get CPU utilization as a percentage
cpuload = psutil.cpu_percent(interval=1)
# powersave/performance load thresholds
powersave_load_threshold = (50*CPUS)/100
performance_load_threshold = (25*CPUS)/100
# auto-cpufreq log file
auto_cpufreq_log_file = Path("/var/log/auto-cpufreq.log")
auto_cpufreq_log_file_snap = Path("/var/snap/auto-cpufreq/current/auto-cpufreq.log")
@ -310,7 +314,7 @@ def set_powersave():
display_load()
# conditions for setting turbo in powersave
if load1m > (15*CPUS)/100:
if load1m > powersave_load_threshold:
print("High load, setting turbo boost: on")
turbo(True)
elif psutil.cpu_percent(percpu=False, interval=0.01) >= 25.0 or isclose(max(psutil.cpu_percent(percpu=True, interval=0.01)), 100):
@ -329,7 +333,7 @@ def mon_powersave():
# cpu usage/system load
display_load()
if load1m > (15*CPUS)/100:
if load1m > powersave_load_threshold:
print("High load, suggesting to set turbo boost: on")
get_turbo()
footer()
@ -354,7 +358,7 @@ def set_performance():
# cpu usage/system load
display_load()
if load1m >= (10*CPUS)/100:
if load1m >= performance_load_threshold:
print("High load, setting turbo boost: on")
turbo(True)
elif psutil.cpu_percent(percpu=False, interval=0.01) >= 15.0 or isclose(max(psutil.cpu_percent(percpu=True, interval=0.01)), 100):
@ -369,18 +373,22 @@ def set_performance():
# make turbo suggestions in performance
def mon_performance():
# cpu usage/system load
display_load()
if turbo():
print("Currently turbo boost is: on")
print("Suggesting to set turbo boost: on")
if load1m > performance_load_threshold:
print("High load, suggesting to set turbo boost: on")
get_turbo()
footer()
elif psutil.cpu_percent(percpu=False, interval=0.01) >= 25.0 or isclose(max(psutil.cpu_percent(percpu=True, interval=0.01)), 100):
print("High CPU load, suggesting to set turbo boost: on")
get_turbo()
footer()
else:
print("Currently turbo boost is: off")
print("Suggesting to set turbo boost: on")
footer()
print("Load optimal, suggesting to set turbo boost: off")
get_turbo()
footer()
def set_autofreq():