Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. import os
  2. import psutil
  3.  
  4. # Get current Process ID:
  5. pid = os.getpid()
  6.  
  7.  
  8. def get_memory_status(pid):
  9. # Build psutil process from PID:
  10. p = psutil.Process(pid)
  11. print("Process ID:", pid)
  12.  
  13. # Print memory status:
  14. mem_usage = p.memory_percent()
  15. print("Memory:", mem_usage)
  16. print()
  17.  
  18.  
  19. consume_memory = range(20*1000*1000)
  20.  
  21. while True:
  22. get_memory_status(pid)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement