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

View File

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