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.

2
  • Have you looked at this: askubuntu.com/questions/56266/…
    – Marc
    Jan 13, 2016 at 2:40
  • Don't have my linux box avail. atm so can't be specific but look at pidstat which is in the sysstat package. Run man pidstat to see options & at bottom some example commands. You can output to a log & if desired just minimize the terminal for longer term monitoring
    – doug
    Jan 13, 2016 at 3:29

1 Answer 1

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .