fixed display_load function not being executed each iteration

This commit is contained in:
Adnan Hodzic 2020-09-13 20:13:34 +02:00
parent 6f729ed6d4
commit 44c6b37db4
2 changed files with 13 additions and 9 deletions

View File

@ -92,7 +92,8 @@ def main(monitor, live, daemon, install, log, debug):
if os.getenv('PKG_MARKER') == "SNAP": if os.getenv('PKG_MARKER') == "SNAP":
print("Snap package: yes") print("Snap package: yes")
else: else:
app_version() # temp disabled (Issue: #111)
# app_version()
print("Snap package: no") print("Snap package: no")
print("") print("")
python_info() python_info()

View File

@ -171,9 +171,7 @@ def footer(l=79):
def daemon_not_found(): def daemon_not_found():
print("\n" + "-" * 32 + " Daemon check " + "-" * 33 + "\n") print("\n" + "-" * 32 + " Daemon check " + "-" * 33 + "\n")
print("ERROR:\n\nDaemon not enabled, must run install first, i.e: \nsudo auto-cpufreq --install") sys.exit("ERROR:\n\nDaemon not enabled, must run install first, i.e: \nsudo auto-cpufreq --install")
footer()
sys.exit()
def deploy_complete_msg(): def deploy_complete_msg():
print("\n" + "-" * 17 + " auto-cpufreq daemon installed and running " + "-" * 17 + "\n") print("\n" + "-" * 17 + " auto-cpufreq daemon installed and running " + "-" * 17 + "\n")
@ -284,6 +282,12 @@ def countdown(s):
# get cpu usage + system load for (last minute) # get cpu usage + system load for (last minute)
def display_load(): def display_load():
# get system/CPU load
load1m, _, _ = os.getloadavg()
# get CPU utilization as a percentage
cpuload = psutil.cpu_percent(interval=1)
print("\nTotal CPU usage:", cpuload, "%") print("\nTotal CPU usage:", cpuload, "%")
print("Total system load:", load1m, "\n") print("Total system load:", load1m, "\n")
@ -510,13 +514,13 @@ def sysinfo():
# print("\nCPU fan speed:", current_fans, "RPM") # print("\nCPU fan speed:", current_fans, "RPM")
def no_log_msg():
print("\n" + "-" * 30 + " auto-cpufreq log " + "-" * 31 + "\n")
print("ERROR: auto-cpufreq log is missing.\n\nMake sure to run: \"auto-cpufreq --install\" first")
# read log func # read log func
def read_log(): def read_log():
def no_log_msg():
print("\n" + "-" * 30 + " auto-cpufreq log " + "-" * 31 + "\n")
print("ERROR: auto-cpufreq log is missing.\n\nMake sure to run: \"auto-cpufreq --install\" first")
# read log (snap) # read log (snap)
if os.getenv("PKG_MARKER") == "SNAP": if os.getenv("PKG_MARKER") == "SNAP":
if os.path.isfile(auto_cpufreq_log_file_snap): if os.path.isfile(auto_cpufreq_log_file_snap):
@ -529,7 +533,6 @@ def read_log():
else: else:
no_log_msg() no_log_msg()
footer() footer()
sys.exit()
# check if program (argument) is running # check if program (argument) is running