Display CPU usage per each core

This commit is contained in:
Adnan Hodzic 2020-09-13 21:33:32 +02:00
parent eff53d4d2e
commit e405e41fd7
3 changed files with 17 additions and 5 deletions

View File

@ -27,8 +27,8 @@ Supported devices must have an Intel, AMD or ARM CPU's. This tool was developed
* Monitoring
* Basic system information
* CPU frequency
* CPU temperatures
* CPU frequency (system total & per core)
* CPU usage (system total & per core)
* Battery state
* System load
* CPU frequency scaling, governor and [turbo boost](https://en.wikipedia.org/wiki/Intel_Turbo_Boost) management based on

View File

@ -1,6 +1,6 @@
name: auto-cpufreq
base: core20
version: '1.3'
version: '1.3.1'
summary: Automatic CPU speed & power optimizer for Linux
description: |
Automatic CPU speed & power optimizer for Linux based on active

View File

@ -482,8 +482,8 @@ def sysinfo():
print("\n" + "-" * 30 + " Current CPU states " + "-" * 30 + "\n")
print(f"CPU max frequency: {psutil.cpu_freq().max:.0f}MHz")
print(f"CPU min frequency: {psutil.cpu_freq().min:.0f}MHz")
print(f"CPU max frequency: {psutil.cpu_freq().max:.0f} MHz")
print(f"CPU min frequency: {psutil.cpu_freq().min:.0f} MHz")
core_usage = psutil.cpu_freq(percpu=True)
@ -498,6 +498,18 @@ def sysinfo():
# get hardware temperatures
core_temp = psutil.sensors_temperatures()
print("\nCPU usage per each core:\n")
usage_per_core = psutil.cpu_percent(interval=1, percpu=True)
for core_num in range(len(usage_per_core)):
print(f"CPU{core_num}: {usage_per_core[core_num]} %")
core_num += 1
# get number of core temp sensors
core_temp_num = psutil.cpu_count(logical=False)
# get hardware temperatures
core_temp = psutil.sensors_temperatures()
print("\nTemperature for each physical core:\n")
core_num = 0
while core_num < core_temp_num: