0

Possible Duplicate:
Measuring RAM usage of a program

I am trying to use ps to benchmark a program, I'm just not sure which flags to use. I would like to get the amount of RAM the program used in total, what flag should I use?

2 Answers2

2
ps axu|grep YOUR_PROCESS | grep -v  grep|awk {'print $4'}
PersianGulf
  • 10,850
  • This prints 0.7... What does the 0.7 mean? – Peppercat101 Sep 10 '12 at 08:24
  • tty which place of running process, if ? it means a kernel module , and if ttyN , such as tty3 ran in tty3, and ran in pts3 , ran in virtual tty, /dev/pts/N such as /dev/pts/3 are virtual tty sush as gnome-terminal. next field is STAT S,s,Zs+, for more info refer to man of ps.next field is Start that mentioned to start time of program.next field is TIME that mentioned to time of running program.last field is command , if enclosed in bracket it's a kernel module.Unfortunately i don't know about RSS and VSZ fields. – PersianGulf Sep 11 '12 at 00:47
2

For applications that run with more than one instance, you would need to sum the total. You could use awk to do this:

ps aux | awk '/YOUR_APP/ { sum+=$4 } END { print sum }'
jasonwryan
  • 73,126