8

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?

  • Look for phantomjs or slimerjs. – Daniel Beck Jan 11 '14 at 9:46
5

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.

Screenshot

For the tool in question, I'd expect the processes to be called phantomjs or slimerjs based on the Python launcher.

8

You can use ps for that, for example:

ps x -o rss,vsz,command | grep FooProcess

then sort by the real memory (resident set) size of the process using (sort -nr).

6

you can use this command for monitoring usage of PROCESSNAME

top -l 1|grep "PROCESSNAME"|awk '{print "MEM="$9 "\tRPRVT="$10}'

  • He doesn't seem to know the process name. Otherwise it'd show up in Activity Monitor. – Daniel Beck Jan 11 '14 at 9:45
  • sorry i did not expect that one! – abzcoding Jan 11 '14 at 9:46
  • Version with the name in the front: top -l 1 | grep "FOO" | awk '{print "NAME="$2 " MEM="$9 "\tRPRVT="$10}'. – kenorb Aug 25 '15 at 10:22
0

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!)

http://dyhr.com/2009/09/05/how-to-enable-x11-forwarding-with-ssh-on-mac-os-x-leopard/

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. Capture of SSH and X11

Image of process manager running via x11

  • can you please mention in your answer if this also works on OSX since the OP asked about OSX specifically? – Thatkookooguy May 18 '16 at 8:07
  • Yes it does work! – Jay Jul 5 '16 at 14:45
  • I asked that you'll add it in your answer since the original poster asked about OS X specifically. – Thatkookooguy Jul 5 '16 at 15:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.