On Thu, 2007-10-11 at 13:42 -0400, Ross Vandegrift wrote:
> On Tue, Oct 09, 2007 at 06:58:40PM +0700, Patrick Shirkey wrote:
> > Does anyone have a script for monitoring with iostat or vmstat while in
> > async mode?
> >
> > I'm thinking a bash equivalent to the disk monitor on gkrellm which
> > allows me to know when a transfer has completed.
>
> Something like this will return when five seconds have passed with
> no write requests being issues to the device sda:
>
> CURRENT=$(cat /proc/diskstats | grep sda\ | awk '{ print $8 }')
> LAST=0
> while true; do
> LAST=CURRENT
> sleep 5
> CURRENT=$(cat /proc/diskstats | grep sda\ | awk '{ print $8 }')
> if [ "$LAST" == "$CURRENT" ]; then
> break
> fi
> done
>
>
> /proc/diskstats lists a few things. For complete devices (ie,
> /dev/sda instead of /dev/sda1), it lists:
>
> Field 1 -- # of reads issued
> Field 2 -- # of reads merged, field 6 -- # of writes merged
> Field 3 -- # of sectors read
> Field 4 -- # of milliseconds spent reading
> Field 5 -- # of writes completed
> Field 7 -- # of sectors written
> Field 8 -- # of milliseconds spent writing
> Field 9 -- # of I/Os currently in progress
> Field 10 -- # of milliseconds spent doing I/Os
> Field 11 -- weighted # of milliseconds spent doing I/Os
>
>
> Where field n is the nth field after the device name.
>
Hi,
Thanks everyone again for your suggestions. The above is exactly what I
was thinking of. Thanks very much Ross. I owe you a beer.
I had to make a couple of small changes.
CURRENT=$(cat /proc/diskstats | grep sdb\ | awk '{ print $8 }')
LAST=0
while true; do
echo -en l = $LAST c = $CURRENT \\n
sleep 5
CURRENT=$(cat /proc/diskstats | grep sdb\ | awk '{ print $8 }')
if [ $LAST == $CURRENT ]; then
break
fi
LAST=$CURRENT
done
Cheers.
-- Patrick Shirkey Boost Hardware Ltd. _______________________________________________ Linux-audio-dev mailing list Linux-audio-dev@email-addr-hidden http://lists.linuxaudio.org/mailman/listinfo.cgi/linux-audio-devReceived on Fri Oct 12 08:15:02 2007
This archive was generated by hypermail 2.1.8 : Fri Oct 12 2007 - 08:15:02 EEST