Refactored avg_all_core_temp accessibility
This commit is contained in:
parent
99a2b78ac2
commit
fa0979a755
|
@ -374,15 +374,6 @@ def mon_powersave():
|
|||
# set performance and enable turbo
|
||||
def set_performance():
|
||||
|
||||
# access/import necessary variables from get_temp_data func
|
||||
avg_cores_temp, avg_all_core_temp=sysinfo()
|
||||
|
||||
# get CPU utilization as a percentage
|
||||
cpuload = psutil.cpu_percent(interval=1)
|
||||
|
||||
# get system/CPU load
|
||||
load1m, _, _ = os.getloadavg()
|
||||
|
||||
print(f"Setting to use: \"{get_avail_performance()}\" governor")
|
||||
run(f"cpufreqctl --governor --set={get_avail_performance()}", shell=True)
|
||||
if os.path.exists("/sys/devices/system/cpu/cpu0/cpufreq/energy_performance_preference"):
|
||||
|
@ -455,9 +446,6 @@ def set_performance():
|
|||
|
||||
# make turbo suggestions in performance
|
||||
def mon_performance():
|
||||
|
||||
# access/import necessary variables from get_temp_data func
|
||||
avg_cores_temp, avg_all_core_temp=sysinfo()
|
||||
|
||||
# get CPU utilization as a percentage
|
||||
cpuload = psutil.cpu_percent(interval=1)
|
||||
|
@ -672,11 +660,9 @@ def sysinfo():
|
|||
|
||||
# get average temperature of all cores
|
||||
avg_cores_temp = sum(temp_per_cpu)
|
||||
global avg_all_core_temp
|
||||
avg_all_core_temp = float(avg_cores_temp/online_cpu_count)
|
||||
|
||||
# export/make these variables accessible in other functions
|
||||
return avg_cores_temp, avg_all_core_temp
|
||||
|
||||
# print current fan speed | temporarily commented
|
||||
# current_fans = psutil.sensors_fans()['thinkpad'][0].current
|
||||
# print("\nCPU fan speed:", current_fans, "RPM")
|
||||
|
|
Loading…
Reference in New Issue