On 12/02/2019 20:17, Eugene Grosbein wrote: > 13.02.2019 1:14, Eugene Grosbein wrote: > >> Use following command to see how much memory is wasted in your case: >> >> vmstat -z | awk -F, '{printf "%10s %s\n", $2*$5/1024/1024, $1}' | sort -k1,1 >> -rn | head > > Oops, small correction: > > vmstat -z | sed 's/:/,/' | awk -F, '{printf "%10s %s\n", $2*$5/1024/1024, > $1}' | sort -k1,1 -rn | head
I have a much uglier but somewhat more informative "one-liner" for post-processing vmstat -z output: vmstat -z | tail +3 | awk -F '[:,] *' 'BEGIN { total=0; cache=0; used=0 } {u = $2 * $4; c = $2 * $5; t = u + c; cache += c; used += u; total += t; name=$1; gsub(" ", "_", name); print t, name, u, c} END { print total, "TOTAL", used, cache } ' | sort -n | perl -a -p -e 'while (($j, $_) = each(@F)) { 1 while s/^(-?\d+)(\d{3})/$1,$2/; print $_, " "} print "\n"' | column -t This would be much nicer as a small python script. Or, even, we could add a sort option for vmstat -z / -m. -- Andriy Gapon _______________________________________________ freebsd-stable@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"