Created
July 25, 2023 20:11
-
-
Save DavidFricker/6a0e5e3e725ab8c1771eb4921f3f779a to your computer and use it in GitHub Desktop.
tqdm resource usage
This file contains hidden or 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