Skip to content

Instantly share code, notes, and snippets.

@mrdrozdov
Created February 6, 2019 19:52
Show Gist options
  • Save mrdrozdov/70abdf517c60e8ab8da9b989fd2bfdd4 to your computer and use it in GitHub Desktop.
Save mrdrozdov/70abdf517c60e8ab8da9b989fd2bfdd4 to your computer and use it in GitHub Desktop.
ps.py
import os
try:
import psutil
except:
psutil = None
def get_memory_used():
if psutil is None:
return -1
process = psutil.Process(os.getpid())
memory_used = process.memory_info().rss
return memory_used
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment