Last active
November 12, 2024 04:02
-
-
Save karolzlot/26864e21e7347ce41f71f87f156ea266 to your computer and use it in GitHub Desktop.
Monitoring real time cpu and ram usage with tqdm. If you like it please upvote this answer: https://stackoverflow.com/a/69511430/8896457
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tqdm import tqdm | |
from time import sleep | |
import psutil | |
with tqdm(total=100, desc='cpu%', position=1) as cpubar, tqdm(total=100, desc='ram%', position=0) as rambar: | |
while True: | |
rambar.n=psutil.virtual_memory().percent | |
cpubar.n=psutil.cpu_percent() | |
rambar.refresh() | |
cpubar.refresh() | |
sleep(0.5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment