Investigating a Python process - lmmx/devnotes GitHub Wiki
Notes on investigating a Python program (or REPL) at the process level (applicable to other programs!)
First list all processes with various memory metrics (see man ps
for details on the specifiers)
ps -o pid,user,%mem,rss,vsz,start_time,command ax | sort -b -k3 -r | s
Importantly, this includes start_time
which will be a date for processes that began before
midnight, and the 24 hour format time HH:MM
for ones started today.
If you start up a Python console or run a program, you'll be able to search for it by start_time
pretty easily, and from this get its process ID in the first column, pid
.
Using the PID, you can then get more info on precisely what resources this process has used:
sudo pmap -x 133688 | less -S
May be useful when working with custom static object (.so
) libraries, or trying to determine if a
particular one is being used by a Python process.