SHARE
TWEET

Untitled

a guest Oct 21st, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top