I am running a command line utility called casperJS (installed via node npm) from the OSX terminal. It's a long running process and I'd like to see how much memory it is using, together with any subprocesses.
I don't see the process in Activity Monitor so how I can tell how much memory it is using?
25 Answers
In Activity Monitor, you can view the list of processes hierarchically, to easily find any processes started from Terminal. Just select All Processes, Hierarchically in the toolbar.
For the tool in question, I'd expect the processes to be called phantomjs or slimerjs based on the Python launcher.
You can use ps for that, for example:
ps x -o rss,vsz,command | grep FooProcessthen sort by the real memory (resident set) size of the process using (sort -nr).
You can use this command for monitoring usage of PROCESSNAME:
top -l 1 | grep "PROCESSNAME" | awk '{print "MEM="$9 "\tRPRVT="$10}' 3 You can run the same program, but forwarding x11.
This means you'll get the physical window open up on your desktop from which you're SSHing in from - It's much nicer in terms of visualisation
Here's a tutorial on how to set up x11. It's really simple to do, and it's much nicer. (plus it's useful for running graphical installer wizards too!)
EDIT: Here's an example I've screenshotted for you of me SSHing in with X11 forwarding(putty) from my Windows machine to my Linux machine, then starting up my system monitor Ksysguard. As you can see the whole window appears as it would do if you were on the actual machine.
top -l 1 | grep -E "^CPU|^Phys"