Calculate Swap Usage
hello all,
my monitor tools indicate that the percentage of swap used is more than the ideal , so i want to calculate which process is consuming from the swap - I tried the following but it didn't help be 100% #ps -eo vsz,rss,pid,args | sort -n - any suggestion to accurately calculate which process consuming from swap , just the swap no ram + swap ! - Thanks |
Code:
ps -eo vsz,rss,pid,args | sort -n if you want to know how much they are using....then use Code:
pmap pid see my example Code:
$ pmap 3476 |
Quote:
Either way, I think you might be underestimating legitimate use of swap that does not represent any performance problem. |
Quote:
The use of swap by individual mappings of individual pids is available in /proc/pid/smaps but I don't know if there is any decent place to get totals. Also I think there are strange interactions with the page cache that make even the detailed info less meaningful. |
Something as simple as this should work
Code:
for i in /proc/*/smaps ; do echo $i ; awk '/Swap/ {sum += $2}; END{print "Total: " sum}' $i; done |
Quote:
I have never used awk. But since you did almost all the work, a quick look at the man page for awk told me how to improve it to Code:
for i in /proc/*/smaps ; do awk '/Swap/ {sum += $2}; END{if (sum>0) print FILENAME " Total: " sum}' $i; done Sorting on the last field of that output is left as another exercise for the OP. Also note, it only works as root. |
Really thanks , all of the replies really will help me
|
All times are GMT -5. The time now is 02:37 AM. |