Change the way ps-graph scales nodes by memory size.

This commit is contained in:
Scott Wallace 2016-03-17 20:00:48 +00:00
parent ee58a032bb
commit ad024897be

View file

@ -4,7 +4,6 @@
hidezone=1 # convert zonenames to "zone-000n"
cpulimit=10 # scale node size from 0 to cpulimit percent
ram=$(( $(sysctl -n hw.memsize) / 1000 ))
# For an OS where a single busy process shows pcpu as 100%, such as Linux,
# cpulimit can be set to 100. You may want to use smaller values, eg, 10, to
@ -188,7 +187,6 @@ function ps2gv {
'"`output_colors`"'
hidezone = '$hidezone'
cpulimit = '$cpulimit'
ram = '$ram'
}
$1 != curzone { curzone = $1 }
$3 > 10 && $3 != "PID" {
@ -228,7 +226,7 @@ function ps2gv {
sizetxt = ""
} else {
if (cpu > cpulimit) { cpu = cpulimit; }
ratio = ( mem / ram ) * 10;
ratio = mem / 10;
width = sprintf("%.2f", 1 + 1.8 * ratio);
height = sprintf("%.2f", 0.7 + 2.3 * ratio);
sizetxt = " width = \"" width " \" height = \"" height "\" "
@ -245,4 +243,4 @@ function ps2gv {
[ $(uname -s) = "Darwin" ] && ZONE="sess"
ps -eo ${ZONE:=zone},ppid,pid,rss,pcpu,comm | ps2gv | neato -Tpng -Nfontsize=12 -Elen=1.9 | open -f -a /Applications/Preview.app
ps -eo ${ZONE:=zone},ppid,pid,pmem,pcpu,comm | ps2gv | neato -Tpng -Nfontsize=12 -Elen=1.9 | open -f -a /Applications/Preview.app