OBJS = args.o bt_timeline.o devmap.o devs.o dip_rb.o iostat.o latency.o \
misc.o output.o proc.o seek.o trace.o trace_complete.o trace_im.o \
trace_issue.o trace_queue.o trace_remap.o trace_requeue.o \
- ../rbtree.o mmap.o trace_plug.o bno_dump.o unplug_hist.o q2d.o
+ ../rbtree.o mmap.o trace_plug.o bno_dump.o unplug_hist.o q2d.o \
+ aqd.o
all: depend $(PROGS)
--- /dev/null
+/*
+ * blktrace output analysis: generate a timeline & gather statistics
+ *
+ * Copyright (C) 2006 Alan D. Brunelle <Alan.Brunelle@hp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "globals.h"
+
+static struct file_info *aqd_files = NULL;
+
+struct aqd_info {
+ FILE *fp;
+ int na; /* # active */
+};
+
+void *aqd_init(char *str)
+{
+ char *oname;
+ struct aqd_info *ap;
+
+ if (aqd_name == NULL) return NULL;
+
+ ap = malloc(sizeof(*ap));
+ ap->na = 0;
+
+ oname = malloc(strlen(aqd_name) + strlen(str) + 32);
+ sprintf(oname, "%s_%s.dat", aqd_name, str);
+ if ((ap->fp = fopen(oname, "w")) == NULL) {
+ perror(oname);
+ return NULL;
+ }
+ add_file(&aqd_files, ap->fp, oname);
+
+ return ap;
+
+}
+
+void aqd_issue(void *info, double ts)
+{
+ struct aqd_info *ap = info;
+
+ fprintf(ap->fp, "%lf %d\n%lf %d\n", ts, ap->na, ts, ap->na + 1);
+
+ ap->na += 1;
+}
+
+void aqd_complete(void *info, double ts)
+{
+ struct aqd_info *ap = info;
+
+ if (ap->na > 0) {
+ fprintf(ap->fp, "%lf %d\n%lf %d\n", ts, ap->na, ts, ap->na - 1);
+ ap->na -= 1;
+ }
+}
#define SETBUFFER_SIZE (64 * 1024)
-#define S_OPTS "aAB:d:D:e:hi:I:l:m:M:o:p:q:s:S:t:T:u:VvX"
+#define S_OPTS "aAB:d:D:e:hi:I:l:m:M:o:p:q:Q:s:S:t:T:u:VvX"
static struct option l_opts[] = {
{
.name = "seek-absolute",
.flag = NULL,
.val = 'q'
},
+ {
+ .name = "active-queue-depth",
+ .has_arg = required_argument,
+ .flag = NULL,
+ .val = 'Q'
+ },
{
.name = "seeks",
.has_arg = required_argument,
"[ -o <output name> | --output-file=<output name> ]\n" \
"[ -p <output name> | --per-io-dump=<output name> ]\n" \
"[ -q <output name> | --q2c-latencies=<output name> ]\n" \
+ "[ -Q <output name> | --active-queue-depth=<output name> ]\n" \
"[ -s <output name> | --seeks=<output name> ]\n" \
"[ -S <interval> | --iostat-interval=<interval> ]\n" \
"[ -t <sec> | --time-start=<sec> ]\n" \
case 'q':
q2c_name = strdup(optarg);
break;
+ case 'Q':
+ aqd_name = strdup(optarg);
+ break;
case 's':
seek_name = strdup(optarg);
break;
char *devices, *exes, *input_name, *output_name, *seek_name, *bno_dump_name;
char *d2c_name, *q2c_name, *per_io_name, *unplug_hist_name;
-char *sps_name;
+char *sps_name, *aqd_name;
FILE *ranges_ofp, *avgs_ofp, *xavgs_ofp, *per_io_ofp, *msgs_ofp;
int verbose, done, time_bounded, output_all_data, seek_absolute;
int easy_parse_avgs;
dip->unplug_hist_handle = unplug_hist_init(device);
dip->seek_handle = seeki_init(mkhandle(str, device, "_d2d"));
dip->q2q_handle = seeki_init(mkhandle(str, device, "_q2q"));
+ dip->aqd_handle = aqd_init(mkhandle(str, device, "_aqd"));
latency_init(dip);
list_add_tail(&dip->hash_head, &dev_heads[DEV_HASH(device)]);
list_add_tail(&dip->all_head, &all_devs);
\newpage\section{\label{sec:cmd-line}Command Line}
\begin{verbatim}
-Usage: btt 2.05
+Usage: btt 2.05
[ -a | --seek-absolute ]
[ -A | --all-data ]
[ -B <output name> | --dump-blocknos=<output name> ]
[ -o <output name> | --output-file=<output name> ]
[ -p <output name> | --per-io-dump=<output name> ]
[ -q <output name> | --q2c-latencies=<output name> ]
+[ -Q <output name> | --active-queue-depth=<output name> ]
[ -s <output name> | --seeks=<output name> ]
[ -S <interval> | --iostat-interval=<interval> ]
[ -t <sec> | --time-start=<sec> ]
This option instructs \texttt{btt} to generate the Q2C latency file
discussed in section~\ref{sec:lat-q2c}.
+\subsection{\label{sec:o-Q}\texttt{--active-queue-depth}/\texttt{-Q}}
+
+ This option tells \texttt{btt} to generate a data file (using the given
+ name as a base) which contains: A time stamp in the first column,
+ and then the number of \emph{active} requests issued to the device
+ driver. (The value is incremented when an \emph{issue} is performend,
+ and decremented when a \emph{complete} is performed.
+
\subsection{\label{sec:o-s}\texttt{--seeks}/\texttt{-s}}
This option instructs \texttt{btt} to generate the seek data file
struct region_info regions;
struct devmap *map;
void *q2q_handle, *seek_handle, *bno_dump_handle, *unplug_hist_handle;
- void *q2d_priv;
+ void *q2d_priv, *aqd_handle;
FILE *d2c_ofp, *q2c_ofp;
struct avgs_info avgs;
struct stats stats, all_stats;
extern char bt_timeline_version[], *devices, *exes, *input_name, *output_name;
extern char *seek_name, *iostat_name, *d2c_name, *q2c_name, *per_io_name;
-extern char *bno_dump_name, *unplug_hist_name, *sps_name;
+extern char *bno_dump_name, *unplug_hist_name, *sps_name, *aqd_name;
extern double range_delta;
extern FILE *ranges_ofp, *avgs_ofp, *xavgs_ofp, *iostat_ofp, *per_io_ofp;
extern FILE *msgs_ofp;
void handle_args(int argc, char *argv[]);
void clean_args();
+/* aqd.c */
+void *aqd_init(char *str);
+void aqd_issue(void *info, double ts);
+void aqd_complete(void *info, double ts);
+
/* devmap.c */
int dev_map_read(char *fname);
struct devmap *dev_map_find(__u32 device);
update_cregion(&c_iop->dip->regions, c_iop->t.time);
if (c_iop->pip)
update_cregion(&c_iop->pip->regions, c_iop->t.time);
+ aqd_complete(c_iop->dip->aqd_handle, BIT_TIME(c_iop->t.time));
dip_foreach_list(c_iop, IOP_Q, &head);
list_for_each_safe(p, q, &head) {
d_iop->dip->n_ds++;
if (!remapper_dev(d_iop->t.device))
update_d_histo(d_iop->t.bytes);
+ aqd_issue(d_iop->dip->aqd_handle, BIT_TIME(d_iop->t.time));
dip_foreach_list(d_iop, IOP_Q, &head);
list_for_each_safe(p, q, &head) {
.SH SYNOPSIS
.B btt
[ \-a | \-\-seek\-absolute ]
-.RS 4
+.br
[ \-A | \-\-all\-data ]
.br
[ \-B <\fIoutput name\fR> | \-\-dump\-blocknos=<\fIoutput name\fR> ]
.br
[ \-q <\fIoutput name\fR> | \-\-q2c\-latencies=<\fIoutput name\fR> ]
.br
+[ \-Q <\fIoutput name\fR> | \-\-active\-queue\-depth=<\fIoutput name\fR> ]
+.br
[ \-s <\fIoutput name\fR> | \-\-seeks=<\fIoutput name\fR> ]
.br
[ \-S <\fIinterval\fR> | \-\-iostat\-interval=<\fIinterval\fR> ]
name for each device.
.RE
+.B \-Q <\fIoutput name\fR>
+.br
+.B \-\-active\-queue\-depth=<\fIoutput name\fR>
+.RS 4
+The \-Q option allows one to output data files showing the time stamp
+and the depth of active commands (those issued but not completed).
+.RE
+
.B \-s <\fIoutput name\fR>
.br
.B \-\-seeks=<\fIoutput name\fR>