2

Do you know How to monitor memory usage of a single process?

I want to get Memory usage over a given time frame including maximum usage and average usage.

Don't tell me use top -p PID, since I cannot stare the screen for hours to check the maximum memory usage.

heemayl
  • 93,925

1 Answers1

2

Install sysstat package

Read man pidstat, look at option & for example commands go to bottom of man page.

Ex. of nautilus, current id here as reported by ps is 2286, generating 120 reports 60 secs apart, outputting to a log in home folder

Get process id you want to track, many ways, a couple below - (start process/app

find in list

ps axu

If you know the name then this works fine, current example of nautilus

ps axu |grep nautilus |grep -v grep

Then in a terminal, (replacing your process # after -p

pidstat -r -p 2286 60 120 > naut-mem.log

If desired just minimize terminal while pidstat is running

If you plan on outputting to same log file several times & want it appended to then use >> instead of > in command

doug
  • 17,212