Mercurial > hg > config
comparison python/example/rss.py @ 821:7c2dbd45c346
rss example program
| author | Jeff Hammel <k0scist@gmail.com> |
|---|---|
| date | Tue, 31 Jan 2017 17:38:05 -0800 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 820:737b9eda7f77 | 821:7c2dbd45c346 |
|---|---|
| 1 #!/usr/bin/env python | |
| 2 | |
| 3 import psutil | |
| 4 | |
| 5 PSNAME = 'python' | |
| 6 | |
| 7 for process in psutil.process_iter(): | |
| 8 try: | |
| 9 memory = process.memory_info() | |
| 10 if process.name() == PSNAME: | |
| 11 print int(memory.rss) | |
| 12 except Exception: | |
| 13 pass |
