Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I need a command that can get the memory consumption of a process called "job_runner_o".

Running ubuntu 10.10

Any thoughts?

share|improve this question

migrated from stackoverflow.com Apr 2 '11 at 17:18

This question came from our site for professional and enthusiast programmers.

1  
Do you mean top? –  Oded Apr 2 '11 at 17:09
    
htop is better, in my opinion. But I don't know if Ran wants an interactive or scriptable command. –  André Paramés Apr 2 '11 at 23:12
add comment

2 Answers

up vote 6 down vote accepted

You could use ps column selection:

ps -eo vsz,rss,comm|grep job_runner_0

will list the virtual memory size (vsz) and resident set size (rss). The the ps man page for details about these columns and the other ones available.

You should also look at the files in /proc/$pid/, especially /proc/$pid/status. They contain a lot of information. For example, try:

cat /proc/`pgrep job_runner_0`/status

(This assumes that there is only one process named job_runner_0.)

Yet another quick option is pmap, which will list detailed process mapping information.

pmap -x $(pidof job_runner_0)

for a full detailed listing (this is present in one of the /proc files also).

If there are several processes with that name, and you just want the total mem used, this can work:

pmap $(pgrep job_runner_0) | grep "^ total"
share|improve this answer
add comment

Execute the following on a shell:

grep VmRSS /proc/$(pidof job_runner_o)/status
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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