From dcf4f53e5c2196576afb7673cefdd6d88b4dbca2 Mon Sep 17 00:00:00 2001 From: Adnan Hodzic Date: Mon, 30 Dec 2019 21:07:34 +0100 Subject: [PATCH] added option to clean screen + other minor changes --- auto-cpufreq.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/auto-cpufreq.py b/auto-cpufreq.py index 5e06ee4..f1eebbc 100644 --- a/auto-cpufreq.py +++ b/auto-cpufreq.py @@ -12,13 +12,12 @@ import re # ToDo: # - check if debian based + first time setup (install necessary packages) -# - add option to run as daemon on boot -# - add revert options +# - add option to run as daemon on boot (systemd) +# - add revert/uninstall options for ^ # - sort out imports # - add option to enable turbo in powersave # - go thru all other ToDo's # - copy cpufreqctl script if it doesn't exist -# - clean/refresh screen instead of constant publish # global var p = psutil @@ -80,15 +79,18 @@ def set_turbo(): if load1m > 2: print("High load, turbo bost: on") s.run("echo 0 > /sys/devices/system/cpu/intel_pstate/no_turbo", shell=True) + print("\n" + "-" * 60 + "\n") # print("High load:", load1m) # print("CPU load:", cpuload, "%") elif cpuload > 25: print("High CPU load, turbo boost: on") s.run("echo 0 > /sys/devices/system/cpu/intel_pstate/no_turbo", shell=True) + print("\n" + "-" * 60 + "\n") else: print("Load optimal, turbo boost: off") s.run("echo 1 > /sys/devices/system/cpu/intel_pstate/no_turbo", shell=True) + print("\n" + "-" * 60 + "\n") def autofreq(): @@ -136,7 +138,7 @@ def sysinfo(): # ToDo: make more generic and not only for thinkpad #print(psutil.sensors_fans()) current_fans = p.sensors_fans()['thinkpad'][0].current - print("\nCPU fan speed:", current_fans), "RPM" + print("\nCPU fan speed:", current_fans, "RPM") # ToDo: add CPU temperature for each core # issue: https://github.com/giampaolo/psutil/issues/1650 @@ -149,4 +151,5 @@ if __name__ == '__main__': gov_check() sysinfo() autofreq() - time.sleep(10) \ No newline at end of file + time.sleep(10) + subprocess.call("clear") \ No newline at end of file