#!/usr/bin/awk -f
BEGIN {
	printf "%18s    %8s %8s %8s\n", "cache", "active", "alloc", "%util";
}

{
	if (($3 + 0.0) != 0.0) {
		pct  = (100.0 * $2) / $3;
		frac = ((10000.0 * $2) / $3) % 100;
	} else {
		pct  = 100.0;
		frac = 0.0;
	}
	active = ($2 * $4)/1024;
	alloc  = ($3 * $4)/1024;
	if ((alloc - active) < 1.0) {
		pct  = 100.0;
		frac = 0.0;
	}
	printf "%20s: %8dKB %8dKB  %3d.%-2d\n", $1, active, alloc, pct, frac;
}