#!/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}'