diff --git a/psutil/psutil_example.py b/psutil/psutil_example.py new file mode 100644 index 00000000..9dbc973f --- /dev/null +++ b/psutil/psutil_example.py @@ -0,0 +1,28 @@ +import psutil +import os +import time + +os.system("title System Monitoring") +os.system("color A") + +while True: + + os.system("cls") + + print("\n Processes:",len(psutil.pids())) + + cpu_n = 0 + + for cpu in psutil.cpu_percent(percpu=True): + cpu_n += 1 + print("\n CPU %s: %.1f%%"%(cpu_n,cpu)) + + battery = psutil.sensors_battery() + print("\n Battery: %i%%"%battery.percent) + + memory = psutil.virtual_memory() + print("\n Memory: %.1f%%"%memory.percent) + + time.sleep(1) + + \ No newline at end of file