parent
70c646f9cb
commit
5223e6e3bc
|
@ -36,6 +36,10 @@ load1m, _, _ = os.getloadavg()
|
||||||
# get CPU utilization as a percentage
|
# get CPU utilization as a percentage
|
||||||
cpuload = psutil.cpu_percent(interval=1)
|
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
|
||||||
auto_cpufreq_log_file = Path("/var/log/auto-cpufreq.log")
|
auto_cpufreq_log_file = Path("/var/log/auto-cpufreq.log")
|
||||||
auto_cpufreq_log_file_snap = Path("/var/snap/auto-cpufreq/current/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()
|
display_load()
|
||||||
|
|
||||||
# conditions for setting turbo in powersave
|
# conditions for setting turbo in powersave
|
||||||
if load1m > (15*CPUS)/100:
|
if load1m > powersave_load_threshold:
|
||||||
print("High load, setting turbo boost: on")
|
print("High load, setting turbo boost: on")
|
||||||
turbo(True)
|
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):
|
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
|
# cpu usage/system load
|
||||||
display_load()
|
display_load()
|
||||||
|
|
||||||
if load1m > (15*CPUS)/100:
|
if load1m > powersave_load_threshold:
|
||||||
print("High load, suggesting to set turbo boost: on")
|
print("High load, suggesting to set turbo boost: on")
|
||||||
get_turbo()
|
get_turbo()
|
||||||
footer()
|
footer()
|
||||||
|
@ -354,7 +358,7 @@ def set_performance():
|
||||||
# cpu usage/system load
|
# cpu usage/system load
|
||||||
display_load()
|
display_load()
|
||||||
|
|
||||||
if load1m >= (10*CPUS)/100:
|
if load1m >= performance_load_threshold:
|
||||||
print("High load, setting turbo boost: on")
|
print("High load, setting turbo boost: on")
|
||||||
turbo(True)
|
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):
|
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
|
# make turbo suggestions in performance
|
||||||
def mon_performance():
|
def mon_performance():
|
||||||
|
|
||||||
# cpu usage/system load
|
# cpu usage/system load
|
||||||
display_load()
|
display_load()
|
||||||
|
|
||||||
if turbo():
|
if load1m > performance_load_threshold:
|
||||||
print("Currently turbo boost is: on")
|
print("High load, suggesting to set turbo boost: on")
|
||||||
print("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:
|
else:
|
||||||
print("Currently turbo boost is: off")
|
print("Load optimal, suggesting to set turbo boost: off")
|
||||||
print("Suggesting to set turbo boost: on")
|
get_turbo()
|
||||||
|
footer()
|
||||||
footer()
|
|
||||||
|
|
||||||
|
|
||||||
def set_autofreq():
|
def set_autofreq():
|
||||||
|
|
Loading…
Reference in New Issue