Operating System - Linux
1828239 Members
2406 Online
109975 Solutions
New Discussion

vmstat - getting memory and CPU utlization

 
Danny Fang
Frequent Advisor

vmstat - getting memory and CPU utlization

HI,
I would like to get the memory used (in MB) for a particular running application with vmstat (see output from vmstat).

I would like to obtain the active memory of a particular application by specifying the -a option:
bash-2.03$ vmstat -a 10 10
Usage: vmstat [-cipsS] [disk ...] [interval [count]]
bash-2.03$ vmstat -a 10 10

May I know how I could obtain the active memory from vmstat? Also, I'd like to verify if by getting the active memory would tell me the amount of memory consumed(in MB) for an application?

As for the CPU utilization for an application, do I refer to the "sys" or "usr" column under the heading "cpu" from the vmstat output?

Could anyone help me out?

Thanks
2 REPLIES 2
Raj D.
Honored Contributor

Re: vmstat - getting memory and CPU utlization

Hi Danny ,

vmstat will give virtual memory statistics , and you can check paging/swapping and cpu usage as well.

Use top command to check Memory usauge , for the processes. You can also use ps -ef , with grep also , for top process.

Cheers.
Raj


" If u think u can , If u think u cannot , - You are always Right . "
RAC_1
Honored Contributor

Re: vmstat - getting memory and CPU utlization

vmstat is not for calculating memory usage of a process. It is tool for looking at overall system memory usage.

You can check a memeory usage of a process as follows.

UNIX95= ps -C"process_name" -o "vsz,args,ppid,pid"

The value of vsz is in KB.
you can also do
ps -lp"process_pid" and check SZ columns. (the value here is in pages. Ususally the page size is 4096 bytes)
There is no substitute to HARDWORK