linux - Getting per user cpu and memory consumption statistics

07
2014-05
  • user3134198

    Is there a way to get cpu and memory consumption statistics summaries per user the same way prstat -t on Solaris shows them?

    The prstat(1) utility in Solaris display has fields NPROC UserName SWAP RSS Memory TimeCPU.

    Are there any scripts available to generate more or less similar output on a Linux system?

  • Answers
    Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

    Related Question

    linux - Get process memory consumption
  • Ran

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

    Running ubuntu 10.10

    Any thoughts?


  • Related Answers
  • Mat

    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"
    
  • karlphillip

    Execute the following on a shell:

    grep VmRSS /proc/$(pidof job_runner_o)/status