From ad024897be1979cbae051021bdd9281a53e85679 Mon Sep 17 00:00:00 2001 From: Scott Wallace Date: Thu, 17 Mar 2016 20:00:48 +0000 Subject: [PATCH] Change the way ps-graph scales nodes by memory size. --- bin/ps-graph | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/bin/ps-graph b/bin/ps-graph index 51d3fdf..2474838 100755 --- a/bin/ps-graph +++ b/bin/ps-graph @@ -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