trivial things like spacing again

This commit is contained in:
Brendan McDevitt 2016-10-16 09:42:03 -05:00
parent e382025b68
commit 4663dbc490

View file

@ -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
}