revamped info is shown by splitting sysinfo func

This commit is contained in:
Adnan Hodzic 2020-09-10 23:01:30 +02:00
parent 39a9c04f33
commit 7f0ad729c9
2 changed files with 24 additions and 18 deletions

View File

@ -37,6 +37,7 @@ def main(monitor, live, daemon, install, log, debug):
root_check() root_check()
gov_check() gov_check()
cpufreqctl() cpufreqctl()
distro_info()
sysinfo() sysinfo()
set_autofreq() set_autofreq()
countdown(5) countdown(5)
@ -46,6 +47,7 @@ def main(monitor, live, daemon, install, log, debug):
root_check() root_check()
gov_check() gov_check()
cpufreqctl() cpufreqctl()
distro_info()
sysinfo() sysinfo()
set_autofreq() set_autofreq()
countdown(5) countdown(5)
@ -58,9 +60,12 @@ def main(monitor, live, daemon, install, log, debug):
elif monitor: elif monitor:
while True: while True:
root_check() root_check()
footer()
running_daemon() running_daemon()
gov_check() gov_check()
cpufreqctl() cpufreqctl()
distro_info()
print("")
sysinfo() sysinfo()
mon_autofreq() mon_autofreq()
countdown(5) countdown(5)
@ -68,9 +73,12 @@ def main(monitor, live, daemon, install, log, debug):
elif live: elif live:
while True: while True:
root_check() root_check()
footer()
running_daemon() running_daemon()
gov_check() gov_check()
cpufreqctl() cpufreqctl()
distro_info()
print("")
sysinfo() sysinfo()
set_autofreq() set_autofreq()
countdown(5) countdown(5)
@ -79,14 +87,17 @@ def main(monitor, live, daemon, install, log, debug):
# ToDo: fail if log is missing or empty (on) # ToDo: fail if log is missing or empty (on)
read_log() read_log()
elif debug: elif debug:
root_check()
footer() footer()
distro_info() distro_info()
driver_check()
if os.getenv('PKG_MARKER') == "SNAP": if os.getenv('PKG_MARKER') == "SNAP":
print("Snap package: yes") print("Snap package: yes")
else: else:
print("Snap package: no") print("Snap package: no")
print("")
python_info() python_info()
print("")
sysinfo()
footer() footer()
elif install: elif install:
if os.getenv('PKG_MARKER') == "SNAP": if os.getenv('PKG_MARKER') == "SNAP":

View File

@ -403,7 +403,6 @@ def python_info():
def distro_info(): def distro_info():
dist = "UNKNOWN distro" dist = "UNKNOWN distro"
version = "UNKNOWN version" version = "UNKNOWN version"
@ -430,27 +429,12 @@ def distro_info():
print("Linux distro: " + dist) print("Linux distro: " + dist)
print("Linux kernel: " + pl.release()) print("Linux kernel: " + pl.release())
def driver_check():
driver = getoutput("cpufreqctl --driver")
print("Driver: " + driver)
def sysinfo(): def sysinfo():
""" """
get system information get system information
""" """
# call/get distro_info # processor_info
distro_info()
# call/get driver_check
driver_check()
cpu_arch = pl.machine()
cpu_count = psutil.cpu_count()
print("Architecture:", cpu_arch)
# get processor
with open("/proc/cpuinfo", "r") as f: with open("/proc/cpuinfo", "r") as f:
line = f.readline() line = f.readline()
while line: while line:
@ -459,8 +443,19 @@ def sysinfo():
break break
line = f.readline() line = f.readline()
# get cores count
cpu_count = psutil.cpu_count()
print("Cores:", cpu_count) print("Cores:", cpu_count)
# get architecture
cpu_arch = pl.machine()
print("Architecture:", cpu_arch)
# get driver
driver = getoutput("cpufreqctl --driver")
print("Driver: " + driver)
print("\n" + "-" * 30 + " Current CPU states " + "-" * 30 + "\n") print("\n" + "-" * 30 + " Current CPU states " + "-" * 30 + "\n")
print(f"CPU max frequency: {psutil.cpu_freq().max:.0f}MHz") 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 min frequency: {psutil.cpu_freq().min:.0f}MHz")