Hi,
On 2015-08-20 10:09, Marko Myllynen wrote:
>
> I'm using this script to see which processes have (parts of) their memory
> swapped:
>
> #!/bin/sh
> #
> # Total swap usage as shown by free(1) and /proc/swaps does not exactly match
> # with the swap usage summed up for individual processes as done below due to
> # pages in swap cache being included in free(1) and /proc/swaps usage amount.
>
> for p in /proc/[1-9]* ; do
> awk '/^[0-9]+ \(/ {printf "%-8s%-18s", $1, $2; nextfile} \
> /Swap:/ {swap+=$2} END {printf "%8.4f MB\n", swap/1024}' $p/stat $p/smaps
> \
> 2>/dev/null ;
> done|sort -gk3|awk '{s=s+$3;print $0}END{printf "Total:%28.4f %s\n", s, "MB"}'
>
> On a busy test system it reports 63 (all being user-land processes) but
> proc.runq.swapped is zero.
testing a bit more on my RHEL 7 laptop, now the script reports 119
processes and pmprobe -v proc.runq.swapped reports:
proc.runq.swapped 1 4
So something causes the metric to change but reading the source doesn't
really tell me what this 4 is supposed to represent?
Thanks,
--
Marko Myllynen
|