| 
#!/bin/rc
#
# The author's identity is lost in the mists of time,
# I don't believe I (steve) wrote it, if they would like to
# step forward and make themselves known I shall give them
# the credit they are due.
switch ($#*) {
case 0
        count=1
        interval=1
case 1
        count=-1
        interval=$1
case 2
        count=$2
        interval=$1
case *
        echo "Usage: $0 [ interval [count]]"
        exit usage
}
echo '   procs      memory       swap'
echo 'rdy blk wat  used/avail  used/avail  ctsw  ints   sys  page   tlb purge load'
n=0
l=(0 0 0 0 0 0 0 0)
while (test $n -ne $count) {
        ps | awk '
$6 == "Syscall"  { ++r }
$6 == "Ready"    { ++r }
$6 == "Scheding" { ++r }
$6 == "Running" { ++r } 
$6 == "Queueing" { ++b }
$6 == "Fault"   { ++w }
$6 == "Pageout" { ++w }
END             { printf "%3d %3d %3d", r, b, w}'
        awk '{printf " %10s %10s", $1, $3}' </dev/swap
        v=`{cat </dev/sysstat}
        for (i in 2 3 4 5 6 7) {
                echo $v($i) $l($i) $interval | awk '{ printf " %5d", ($1-$2)/$3 }' 
        }
        echo $v(8) | awk '{printf " %.2f\n", $1/1000 }'
        l=$v
        n=`{echo $n | awk '{print $1+1}' }
        if (test $n -ne $count)
                sleep $interval
} 
 |