1834462 Members
2473 Online
110067 Solutions
New Discussion

swap

 
SOLVED
Go to solution
Bawitdaba
Frequent Advisor

swap

Hi! Does anyone know if there is a tool to display how much swap area a process is using in every moment?
In glance you can display how much swap the system is using but no process by process.

thanks a lot
mercedes
5 REPLIES 5
Stefan Farrelly
Honored Contributor
Solution

Re: swap


Use gpm instead of glance (the GUI version). Under process list you can choose metrics and there is a metric called PROC_SWAPS (and a cumulative one also). You can monitor these and watch them in realtime (by adjusting the measurement interface interval down to 1 second if you wish).
Im from Palmerston North, New Zealand, but somehow ended up in London...
Stefan Farrelly
Honored Contributor

Re: swap

Oops, that shows if its swapping in realtime. To see how much swap its using look at RES_MEM Metric - any resident memory used by a process must be allocated in swap in equal size (in case it needs to be paged out) so basically it equals swap usage for that process.
Im from Palmerston North, New Zealand, but somehow ended up in London...
Joaquin Gil de Vergara
Respected Contributor

Re: swap

set the UNIX95 environment variavble to XPG4

see man pages for ps. The -H option allows you show a lot of things about process (flags says you if proccess if swapped)

Teach is the best way to learn
Hai Nguyen_1
Honored Contributor

Re: swap

Mercedes,

You can use top to watch the swap space consumed by a specific process under the SIZE column. Man top for more details.

Also, you can run glance then hit s and enter the process id which you want to monitor the swap usage. Read the value in the RSS/VSS field.

Hai
Mike Stroyan
Honored Contributor

Re: swap

The RES_MEM metric is _not_ how much swap a process is using. RES_MEM is how much RAM a process is using. The amount of swap used is closer to the "Total VSS" value. The system reserves swap for most pages of VSS. There are several exceptions. Many or most programs have text areas and shared library text areas that are not backed up by swap. They are backed up by a.out and shared library files. Many programs use shared memory which is used by multiple processes. You need to decide for yourself how much of that shared memory you want to "bill" to each process.
The amount of swap can be very difficult to determine if a program has been modified with "chatr +z enable" to use lazy swap allocation on data areas. Then the data pages don't have swap allocated until they are first touched.
Lazy swap allocation is dangerous because a program can die trying to access a memory location just because the system ran out of swap.