Created
February 6, 2019 19:52
-
-
Save mrdrozdov/70abdf517c60e8ab8da9b989fd2bfdd4 to your computer and use it in GitHub Desktop.
ps.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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