[PATCH] BTT patch: (3/3) time bounded trace analysis
[blktrace.git] / btt / args.c
index 0e8849c5a1f20b39e89931bc8077663de4b35ad6..b0351e8b805a79adb472b4b03ffacfb424eb6e13 100644 (file)
@@ -27,7 +27,7 @@
 #include <fcntl.h>
 #include "globals.h"
 
-#define S_OPTS "d:D:e:hi:I:l:M:o:p:q:s:S:Vv"
+#define S_OPTS "d:D:e:hi:I:l:M:o:p:q:s:S:t:T:Vv"
 static struct option l_opts[] = {
        {
                .name = "range-delta",
@@ -107,6 +107,18 @@ static struct option l_opts[] = {
                .flag = NULL,
                .val = 'S'
        },
+       {
+               .name = "time-start",
+               .has_arg = required_argument,
+               .flag = NULL,
+               .val = 't'
+       },
+       {
+               .name = "time-end",
+               .has_arg = required_argument,
+               .flag = NULL,
+               .val = 'T'
+       },
        {
                .name = "version",
                .has_arg = no_argument,
@@ -138,6 +150,8 @@ static char usage_str[] = \
        "[ -q <output name> | --q2c-latencies=<output name> ]\n" \
        "[ -s <output name> | --seeks=<output name> ]\n" \
        "[ -S <interval>    | --iostat-interval=<interval> ]\n" \
+       "[ -t <sec>         | --time-start=<sec> ]\n" \
+       "[ -T <sec>         | --time-end=<sec> ]\n" \
        "[ -V               | --version ]\n" \
        "[ -v               | --verbose ]\n\n";
 
@@ -196,6 +210,14 @@ void handle_args(int argc, char *argv[])
                        iostat_interval = (__u64)interval * 1000000000LL;
                        break;
                }
+               case 't':
+                       sscanf(optarg, "%lf", &t_astart);
+                       time_bounded = 1;
+                       break;
+               case 'T':
+                       sscanf(optarg, "%lf", &t_aend);
+                       time_bounded = 1;
+                       break;
                case 'v':
                        verbose = 1;
                        break;