Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to monitor a processes memory usage over time - ubuntu [closed]

I want to watch a given process in unix over time to see what time memory grows (its a long running job)

I guess I could do

ps -aux | grep PID

and run this from cron every 5 minutes, but it seems there should be a better way.

Is there a way I can use sar to do this?

like image 382
Joelio Avatar asked Sep 02 '11 01:09

Joelio


1 Answers

I use the following:

$ ps -o rss $(pgrep executablename)

Put that in a while loop or use watch to monitor it over time coupled with tail. You can also tee it to a file and have gnuplot plot it for you and refresh it every few seconds.

like image 66
holygeek Avatar answered Nov 15 '22 01:11

holygeek