1 #!/bin/sh 2 # Copyright (c) 2005 Silicon Graphics, Inc. 3 # All rights reserved. 4 # 5 # Nathan Scott <nathans (at] sgi.com> 6 # 14 Sep 2005 Initial version 7 # 8 9 TRACEOPTS="" 10 PARSEOPTS="-b100000" 11 USAGE="Usage: btrace [-s] [-t] [-w N] [-n N] [-b N] [-a <trace>...] [-r <dbg mnt>] <dev>..." 12 DIRNAME=`dirname $0` 13 14 while getopts "a:w:n:b:r:sthv" c 15 do 16 case $c in 17 a) TRACEOPTS=$TRACEOPTS" -a "$OPTARG" ";; 18 w) TRACEOPTS=$TRACEOPTS" -w "$OPTARG" ";; 19 n) TRACEOPTS=$TRACEOPTS" -n "$OPTARG" ";; 20 b) TRACEOPTS=$TRACEOPTS" -b "$OPTARG" ";; 21 r) TRACEOPTS=$TRACEOPTS" -r "$OPTARG" ";; 22 s) PARSEOPTS=$PARSEOPTS" -s";; 23 t) PARSEOPTS=$PARSEOPTS" -t";; 24 h) PARSEOPTS=$PARSEOPTS" -h";; 25 v) PARSEOPTS=$PARSEOPTS" -v";; 26 \?) echo $USAGE 1>&2 27 exit 2 28 ;; 29 esac 30 done 31 32 shift `expr $OPTIND - 1` 33 if [ $# -eq 0 ]; then 34 echo $USAGE 1>&2 35 exit 2 36 fi 37 38 ${DIRNAME}/blktrace ${TRACEOPTS} -o- $@ | ${DIRNAME}/blkparse ${PARSEOPTS} -i- 39