From 4663dbc4906ac1c51ddb56ad49f0ddfa46e36359 Mon Sep 17 00:00:00 2001 From: Brendan McDevitt Date: Sun, 16 Oct 2016 09:42:03 -0500 Subject: [PATCH] trivial things like spacing again --- .bash_functions | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.bash_functions b/.bash_functions index f1fa3c3..126da40 100644 --- a/.bash_functions +++ b/.bash_functions @@ -79,10 +79,11 @@ mem_usage() ps aux |grep -v USER|awk '{ cpu[$1]+=$3; rss[$1]+=$6; sum+=$6} END { for (user in cpu) printf("%-11s Memory: %9.1f MiB CPU%%: %5.1f\n", user, rss[user]/1024, cpu[user]); } END {printf("Total Memory: %15.1f MiB", sum/1024);}'|sort -n -k3;echo;free -m|egrep -v 'Mem|Swap' } + +# this will grab swap usage and each program using swap and total it. swap_sum() { - # this will grab swap usage and each program using swap and total it. for dir in $(find /proc/ -maxdepth 1 -type d | egrep "^/proc/[0-9]") ; do pid=$(echo $dir | cut -d / -f 3);prog=$(ps -p $pid -o comm --no-headers|awk '{print $1}'); for swap in $(grep Swap $dir/smaps 2>/dev/null| awk '{print $2}');do let sum=$sum+$swap; done; echo "$prog $sum "|grep -vw 0;sum=0;done|awk '{ swap[$1]+=$2; sum+=$2} END { for (prog in swap) printf("%-15s Swap: %10.1f MiB\n", prog, swap[prog]/1024); } END {printf("Total Swap: %20.1f MiB", sum/1024);}'|sort -n -k3 }