We wrote a dirty little script we call "top10", called from the shell
as per the usage() statement:
usage()
{
echo "usage: top10 chunkio|chunkr|chunkw|mem|userrd|
userwr"
sleep
3
exit
}
case $#
in
1)
break;;
*)
usage;;
esac
getmemstats()
{
onstat -g ses|sort -n -r -k 7|head|grep "^[0-9]"|
\
awk '{printf "%8s %8s %8s %8s %8s\n", $1, $2, $4, $7, $8 }' >
t1.out
echo SID USER PID TOTMEM USEDMEM PROCESS |awk '{printf "%10s %10s
%10s %10s %10s %20s\n", $1, $2, $3, $4, $5,
$6 }'
while true;
do
dataline=`line`
[ $? -ne 0 ]&&
break
set
$dataline
if [ $3 -lt
0 ];then
proc=UNKNOWN
else
proc=`ps -fp$3|grep -v "PPID"|awk '{print
$NF}'`
fi
echo $1 $2 $3 $4 $5 $proc|awk '{printf "%10s %10s %10s %10s
%10s %20s\n", $1, $2, $3, $4, $5,
$6 }'
done <
t1.out
rm
t1.out
}
case $1
in
chunkio)
# chunk usage by overall I/
O:
echo "gfd pathname totalops dskread dskwrite io/
s";
onstat -g iof|sort -n -r -k6|
head;;
chunkr)
# chunk usage by
reads:
echo "gfd pathname totalops dskread dskwrite io/
s";
onstat -g iof|sort -n -r -k4|
head;;
chunkw)
# chunk usage by
writes:
echo "gfd pathname totalops dskread dskwrite io/
s";
onstat -g iof|sort -n -r -k5|
head;;
mem)
#
Memory
getmemstats;;
userrd)
# User Read
Activity
onstat -u|egrep -v " informix |Informix Dynamic|Userthreads|^$|address
"|sort -n -r -k 9|
head;;
userwr)
# User Write
Activity
onstat -u|egrep -v " informix |Informix Dynamic|Userthreads|^$|address
"|sort -n -r -k 10|
head;;
*)
usage;;
esac
>> Stay informed about: get top 5 i/o busy session