aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2012-09-06 18:23:05 +0200
committerChris Mason <chris.mason@oracle.com>2012-09-10 20:53:05 -0400
commitf2e40ddd2b405fb22bd93ca61160e3505921d59e (patch)
tree1cd5ea6a2ae78239dbf9066d0564113353c34acf
parentd44f4c4cc63843b72ea06d65ccdaecb2f4c89657 (diff)
downloadblktrace-f2e40ddd2b405fb22bd93ca61160e3505921d59e.tar.gz
iowatcher: Add option to set action which should be displayed in the IO graph
Sometimes this is useful to see how IO scheduler or storage itself changes the IO submitted by the application. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
-rw-r--r--iowatcher/blkparse.c16
-rw-r--r--iowatcher/blkparse.h1
-rw-r--r--iowatcher/main.c16
3 files changed, 32 insertions, 1 deletions
diff --git a/iowatcher/blkparse.c b/iowatcher/blkparse.c
index ab7a637..a0fb8c5 100644
--- a/iowatcher/blkparse.c
+++ b/iowatcher/blkparse.c
@@ -41,6 +41,7 @@
static struct list_head io_hash_table[IO_HASH_TABLE_SIZE];
static u64 ios_in_flight = 0;
+extern int plot_io_action;
/*
* Trace categories
@@ -613,8 +614,23 @@ static inline int tput_event(struct trace *trace)
return __BLK_TA_COMPLETE;
}
+int action_char_to_num(char action)
+{
+ switch (action) {
+ case 'Q':
+ return __BLK_TA_QUEUE;
+ case 'D':
+ return __BLK_TA_ISSUE;
+ case 'C':
+ return __BLK_TA_COMPLETE;
+ }
+ return -1;
+}
+
static inline int io_event(struct trace *trace)
{
+ if (plot_io_action)
+ return plot_io_action;
if (trace->found_queue)
return __BLK_TA_QUEUE;
if (trace->found_issue)
diff --git a/iowatcher/blkparse.h b/iowatcher/blkparse.h
index 2eff331..6300ced 100644
--- a/iowatcher/blkparse.h
+++ b/iowatcher/blkparse.h
@@ -67,6 +67,7 @@ void find_extreme_offsets(struct trace *trace, u64 *min_ret, u64 *max_ret,
u64 *max_bank_ret, u64 *max_offset_ret);
int filter_outliers(struct trace *trace, u64 min_offset, u64 max_offset,
u64 *yzoom_min, u64 *yzoom_max);
+int action_char_to_num(char action);
void add_iop(struct trace *trace, struct graph_line_data *gld);
void check_record(struct trace *trace);
void add_completed_io(struct trace *trace,
diff --git a/iowatcher/main.c b/iowatcher/main.c
index a3148ac..6d112be 100644
--- a/iowatcher/main.c
+++ b/iowatcher/main.c
@@ -59,6 +59,8 @@ static double max_time = DBL_MAX;
static unsigned long long min_mb = 0;
static unsigned long long max_mb = ULLONG_MAX >> 20;
+int plot_io_action = 0;
+
/*
* this doesn't include the IO graph,
* but it counts the other graphs as they go out
@@ -1025,7 +1027,7 @@ enum {
HELP_LONG_OPT = 1,
};
-char *option_string = "T:t:o:l:r:O:N:d:p:m::h:w:c:x:y:";
+char *option_string = "T:t:o:l:r:O:N:d:p:m::h:w:c:x:y:a:";
static struct option long_options[] = {
{"columns", required_argument, 0, 'c'},
{"title", required_argument, 0, 'T'},
@@ -1042,6 +1044,7 @@ static struct option long_options[] = {
{"height", required_argument, 0, 'h'},
{"xzoom", required_argument, 0, 'x'},
{"yzoom", required_argument, 0, 'y'},
+ {"io-plot-action", required_argument, 0, 'a'},
{"help", no_argument, 0, HELP_LONG_OPT},
{0, 0, 0, 0}
};
@@ -1065,6 +1068,7 @@ static void print_usage(void)
"\t-c (--columns): numbers of columns in graph output\n"
"\t-x (--xzoom): limit processed time to min:max\n"
"\t-y (--yzoom): limit processed sectors to min:max\n"
+ "\t-a (--io-plot-action): plot given action (one of Q,D,C) in IO graph\n"
);
exit(1);
}
@@ -1214,6 +1218,16 @@ static int parse_options(int ac, char **av)
exit(1);
}
break;
+ case 'a':
+ if (strlen(optarg) != 1) {
+action_err:
+ fprintf(stderr, "Action must be one of Q, D, C.");
+ exit(1);
+ }
+ plot_io_action = action_char_to_num(optarg[0]);
+ if (plot_io_action < 0)
+ goto action_err;
+ break;
case '?':
case HELP_LONG_OPT:
print_usage();