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