From fbd48632138f024789bcf7f331e501ab75b7117e Mon Sep 17 00:00:00 2001 From: Jeroenvb Date: Mon, 23 May 2022 05:37:49 +0200 Subject: [PATCH] Fixed where average all core temp is displayed with too many decimals. (#392) * Fixed where average all core temp is displayed with too many decimals. * Made both total system load, and avg temp 2 decimals in cleaner .format form. --- auto_cpufreq/core.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/auto_cpufreq/core.py b/auto_cpufreq/core.py index cae89c8..9f28977 100644 --- a/auto_cpufreq/core.py +++ b/auto_cpufreq/core.py @@ -490,8 +490,8 @@ def display_load(): load1m, _, _ = os.getloadavg() print("\nTotal CPU usage:", cpuload, "%") - print("Total system load:", load1m) - print("Average temp. of all cores:", avg_all_core_temp, "°C", "\n") + print("Total system load: {:.2f}".format(load1m)) + print("Average temp. of all cores: {:.2f} °C \n".format(avg_all_core_temp)) # set minimum and maximum CPU frequencies @@ -593,8 +593,8 @@ def set_powersave(): load1m, _, _ = os.getloadavg() print("\nTotal CPU usage:", cpuload, "%") - print("Total system load:", load1m) - print("Average temp. of all cores:", avg_all_core_temp, "°C") + print("Total system load: {:.2f}".format(load1m)) + print("Average temp. of all cores: {:.2f} °C \n".format(avg_all_core_temp)) # conditions for setting turbo in powersave if conf.has_option("battery", "turbo"): @@ -695,8 +695,8 @@ def mon_powersave(): load1m, _, _ = os.getloadavg() print("\nTotal CPU usage:", cpuload, "%") - print("Total system load:", load1m) - print("Average temp. of all cores:", avg_all_core_temp, "°C") + print("Total system load: {:.2f}".format(load1m)) + print("Average temp. of all cores: {:.2f} °C \n".format(avg_all_core_temp)) if psutil.cpu_percent(percpu=False, interval=0.01) >= 30.0 or isclose( max(psutil.cpu_percent(percpu=True, interval=0.01)), 100 @@ -802,8 +802,8 @@ def set_performance(): load1m, _, _ = os.getloadavg() print("\nTotal CPU usage:", cpuload, "%") - print("Total system load:", load1m) - print("Average temp. of all cores:", avg_all_core_temp, "°C") + print("Total system load: {:.2f}".format(load1m)) + print("Average temp. of all cores: {:.2f} °C \n".format(avg_all_core_temp)) if conf.has_option("charger", "turbo"): auto = conf["charger"]["turbo"] @@ -904,8 +904,8 @@ def mon_performance(): load1m, _, _ = os.getloadavg() print("\nTotal CPU usage:", cpuload, "%") - print("Total system load:", load1m) - print("Average temp. of all cores:", avg_all_core_temp, "°C") + print("Total system load: {:.2f}".format(load1m)) + print("Average temp. of all cores: {:.2f} °C \n".format(avg_all_core_temp)) # get system/CPU load load1m, _, _ = os.getloadavg()