[PATCH] Add btrace script
authorNathan Scott <nathans@sgi.com>
Wed, 14 Sep 2005 17:29:40 +0000 (19:29 +0200)
committerJens Axboe <axboe@suse.de>
Wed, 14 Sep 2005 17:29:40 +0000 (19:29 +0200)
Using blktrace and blkparse in the "standard" piped setup is a little
cumbersome and not very intuitive, so add a script to do this automatically.
This is what users would expect.

btrace [new file with mode: 0644]

diff --git a/btrace b/btrace
new file mode 100644 (file)
index 0000000..d74d9c2
--- /dev/null
+++ b/btrace
@@ -0,0 +1,32 @@
+#!/bin/sh
+# Copyright (c) 2005 Silicon Graphics, Inc.
+# All rights reserved.
+# 
+#      Nathan Scott <nathans@sgi.com>
+#      14 Sep 2005     Initial version
+# 
+
+TRACEOPTS=""
+PARSEOPTS=""
+USAGE="Usage: btrace [-s] [-t] [-a <trace>...] <dev>..."
+DIRNAME=`dirname $0`
+
+while getopts "a:st" c
+do
+       case $c in
+       a)      TRACEOPTS=$TRACEOPTS" -a "$OPTARG" ";;
+       s)      PARSEOPTS=$PARSEOPTS" -s";;
+       t)      PARSEOPTS=$PARSEOPTS" -t";;
+       \?)     echo $USAGE 1>&2
+               exit 2
+               ;;
+       esac
+done
+
+shift `expr $OPTIND - 1`
+if [ $# -eq 0 ]; then
+       echo $USAGE 1>&2
+       exit 2
+fi
+
+${DIRNAME}/blktrace ${TRACEOPTS} -o- $@ | ${DIRNAME}/blkparse ${PARSEOPTS} -i-