summaryrefslogtreecommitdiff
path: root/btrace
blob: 78684dffeb4b320c60ba7b52d7852b07db2b62f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/sh
# Copyright (c) 2005 Silicon Graphics, Inc.
# All rights reserved.
# 
#	Nathan Scott <nathans@sgi.com>
#	14 Sep 2005	Initial version
# 

TRACEOPTS=""
PARSEOPTS=""
SUMMARIZE="-q"	# quiet (no dev/cpu summary by default)
USAGE="Usage: btrace [-s] [-t] [-S] [-w N] [-a <trace>...] <dev>..."
DIRNAME=`dirname $0`

while getopts "a:stSw:" c
do
	case $c in
	a)	TRACEOPTS=$TRACEOPTS" -a "$OPTARG" ";;
	w)	TRACEOPTS=$TRACEOPTS" -w "$OPTARG" ";;
	s)	PARSEOPTS=$PARSEOPTS" -s";;
	t)	PARSEOPTS=$PARSEOPTS" -t";;
	S)	SUMMARIZE="";;
	\?)	echo $USAGE 1>&2
		exit 2
		;;
	esac
done
PARSEOPTS="${PARSEOPTS} ${SUMMARIZE}"

shift `expr $OPTIND - 1`
if [ $# -eq 0 ]; then
	echo $USAGE 1>&2
	exit 2
fi

${DIRNAME}/blktrace ${TRACEOPTS} -o- $@ | ${DIRNAME}/blkparse ${PARSEOPTS} -i-