[PATCH] btrace: make the output easily parsably by default
authorNathan Scott <nathans@sgi.com>
Wed, 14 Sep 2005 17:30:49 +0000 (19:30 +0200)
committerJens Axboe <axboe@suse.de>
Wed, 14 Sep 2005 17:30:49 +0000 (19:30 +0200)
Drop CPU/device summary unless specifically requested.

blkparse.c
btrace

index 01a840e5e167547dcd6df6fb7d820ec723446d71..b3172f1d3ac1d790137cbbf3787807a853c7c0f8 100644 (file)
@@ -91,7 +91,7 @@ struct per_process_info {
 static struct per_process_info *ppi_hash[1 << PPI_HASH_SHIFT];
 static struct per_process_info *ppi_list;
 
-#define S_OPTS "i:o:b:st"
+#define S_OPTS "i:o:b:stq"
 static struct option l_opts[] = {
        {
                .name = "input",
@@ -123,6 +123,12 @@ static struct option l_opts[] = {
                .flag = NULL,
                .val = 't'
        },
+       {
+               .name = "quiet",
+               .has_arg = 0,
+               .flag = NULL,
+               .val = 'q'
+       },
        {
                .name = NULL,
                .has_arg = 0,
@@ -1309,6 +1315,7 @@ int main(int argc, char *argv[])
 {
        char *ofp_buffer;
        int c, ret, mode;
+       int per_device_and_cpu_stats = 1;
 
        while ((c = getopt_long(argc, argv, S_OPTS, l_opts, NULL)) != -1) {
                switch (c) {
@@ -1332,6 +1339,9 @@ int main(int argc, char *argv[])
                case 't':
                        track_ios = 1;
                        break;
+               case 'q':
+                       per_device_and_cpu_stats = 0;
+                       break;
                default:
                        usage(argv[0]);
                        return 1;
@@ -1390,7 +1400,8 @@ int main(int argc, char *argv[])
        if (per_process_stats)
                show_process_stats();
 
-       show_device_and_cpu_stats();
+       if (per_device_and_cpu_stats)
+               show_device_and_cpu_stats();
 
        flush_output();
        return ret;
diff --git a/btrace b/btrace
index d74d9c29a1917eba4da68317a31435ad84ec12fc..f698f9c78a341bec5bf1f5c33f2d172353f4883c 100644 (file)
--- a/btrace
+++ b/btrace
@@ -8,20 +8,23 @@
 
 TRACEOPTS=""
 PARSEOPTS=""
-USAGE="Usage: btrace [-s] [-t] [-a <trace>...] <dev>..."
+SUMMARIZE="-q" # quiet (no dev/cpu summary by default)
+USAGE="Usage: btrace [-s] [-t] [-S] [-a <trace>...] <dev>..."
 DIRNAME=`dirname $0`
 
-while getopts "a:st" c
+while getopts "a:stS" c
 do
        case $c in
        a)      TRACEOPTS=$TRACEOPTS" -a "$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