-
Couldn't load subscription status.
- Fork 7
Investigating a Python process
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 | sImportantly, 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 -SMay 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.