Skip to content

Instantly share code, notes, and snippets.

@joonahn
Created October 19, 2017 09:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joonahn/dac360cc519c840150642daae13ac068 to your computer and use it in GitHub Desktop.
Save joonahn/dac360cc519c840150642daae13ac068 to your computer and use it in GitHub Desktop.
CPU usage of one minute per process
import psutil
def monitor_cpu(pid):
p = psutil.Process(pid)
for i in range(0, 60):
print p.cpu_percent(interval=1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment