Added in -z to provide running waiting-for-issue latencies
authorAlan D. Brunelle <alan.brunelle@hp.com>
Mon, 10 Nov 2008 15:35:44 +0000 (10:35 -0500)
committerAlan D. Brunelle <alan.brunelle@hp.com>
Mon, 10 Nov 2008 15:35:44 +0000 (10:35 -0500)
btt/args.c
btt/bt_timeline.c
btt/devs.c
btt/doc/btt.tex
btt/globals.h
btt/latency.c
btt/trace_issue.c
doc/btt.1

index db4186eea088cbc7f5fc522c0f249dd6e4a53d37..5555e4f10f70b43ea81dfb21b75786c354870f71 100644 (file)
@@ -29,7 +29,7 @@
 
 #define SETBUFFER_SIZE (64 * 1024)
 
-#define S_OPTS "aAB:d:D:e:hi:I:l:L:m:M:o:p:q:Q:s:S:t:T:u:VvX"
+#define S_OPTS "aAB:d:D:e:hi:I:l:L:m:M:o:p:q:Q:s:S:t:T:u:VvXz:"
 static struct option l_opts[] = {
        {
                .name = "seek-absolute",
@@ -181,6 +181,12 @@ static struct option l_opts[] = {
                .flag = NULL,
                .val = 'X'
        },
+       {
+               .name = "q2d-latencies",
+               .has_arg = required_argument,
+               .flag = NULL,
+               .val = 'z'
+       },
        {
                .name = NULL,
        }
@@ -212,6 +218,7 @@ static char usage_str[] = \
        "[ -V               | --version ]\n" \
        "[ -v               | --verbose ]\n" \
        "[ -X               | --easy-parse-avgs ]\n" \
+       "[ -z <output name> | --q2d-latencies=<output name> ]\n" \
        "\n";
 
 static struct file_info *arg_files = NULL;
@@ -336,6 +343,9 @@ void handle_args(int argc, char *argv[])
                case 'X':
                        easy_parse_avgs++;
                        break;
+               case 'z':
+                       q2d_name = strdup(optarg);
+                       break;
                default:
                        usage(argv[0]);
                        exit(1);
index 75e41ca11e836278ce9347d01e9971baa6435293..734ca350a7cfea0eb1bb97b36dcb4a1cf895cb64 100644 (file)
 #include <time.h>
 #include "globals.h"
 
-char bt_timeline_version[] = "2.05";
+char bt_timeline_version[] = "2.06";
 
 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, *aqd_name;
+char *sps_name, *aqd_name, *q2d_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;
index b7943d3ec9c34539121b0ba77c5e891977c33708..6c9870ff3f0bfdf398abf97f3a1c7eb02e7fd419 100644 (file)
@@ -86,6 +86,7 @@ void dip_exit(void)
                seeki_exit(dip->seek_handle);
                seeki_exit(dip->q2q_handle);
                aqd_exit(dip->aqd_handle);
+               plat_exit(dip->q2d_plat_handle);
                plat_exit(dip->q2c_plat_handle);
                plat_exit(dip->d2c_plat_handle);
                bno_dump_exit(dip->bno_dump_handle);
@@ -124,6 +125,8 @@ struct d_info *dip_add(__u32 device, struct io *iop)
                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"));
+               dip->q2d_plat_handle =
+                               plat_init(mkhandle(str, device, "_q2d_plat"));
                dip->q2c_plat_handle =
                                plat_init(mkhandle(str, device, "_q2c_plat"));
                dip->d2c_plat_handle =
index eb4d29a64c8edad84c7776fb95be0fab3746d595..5f7ef1cd2b2c1cf67b395a4fe7541168d677fa90 100644 (file)
@@ -22,7 +22,7 @@
 
 \title{\texttt{btt} User Guide}
 \author{Alan D. Brunelle (Alan.Brunelle@hp.com)}
-\date{21 May 2008}
+\date{30 October 2008}
 
 \begin{document}
 \maketitle
@@ -460,9 +460,9 @@ pdflush       0.000000790 0.000006752 0.247231307  179791
     than grepping through a blkparse output file for example). The
     details on this file is included in section~\ref{sec:per-io}.
 
-    \item[iostat] Latency information -- both Q2C and D2C --
+    \item[iostat] Latency information -- both Q2d, D2c and Q2C --
     on a per-IO basis can be generated. These are described in
-    sections~\ref{sec:lat-q2c} and~\ref{sec:lat-d2c}.
+    section~\ref{sec:lat}.
 
     \item[seek details] A set of data files containing all IO-to-IO
     sector differences can be output, with details found in
@@ -673,15 +673,16 @@ Device:       rrqm/s   wrqm/s     r/s     w/s    rsec/s    wsec/s
     \item start block + number of blocks
   \end{enumerate}
  
-\newpage\section{\label{sec:lat}\label{sec:lat-q2c}\label{sec:lat-d2c}Latency Data Files}
+\newpage\section{\label{sec:lat}\label{sec:lat-q2d}\label{sec:lat-q2c}\label{sec:lat-d2c}Latency Data Files}
 
   The latency data files which can be optionally produced by \texttt{btt}
-  provide per-IO latency information, one for total IO time (Q2C) and
-  one for latencies induced by lower layer drivers and devices (D2C).
+  provide per-IO latency information, one for queue time (Q2D), one
+  for total IO time (Q2C) and one for latencies induced by lower layer
+  drivers and devices (D2C).
 
   In both cases, the first column (X values) represent runtime (seconds),
   while the second column (Y values) shows the actual latency for a
-  command at that time (either Q2C or D2C).
+  command at that time (either Q2D, D2C or Q2C).
 
 \newpage\section{\label{sec:seek}Seek Data Files}
 
@@ -798,7 +799,7 @@ Device:       rrqm/s   wrqm/s     r/s     w/s    rsec/s    wsec/s
 \newpage\section{\label{sec:cmd-line}Command Line}
 
 \begin{verbatim}
-Usage: btt 2.0
+Usage: btt 2.06
 [ -a               | --seek-absolute ]
 [ -A               | --all-data ]
 [ -B <output name> | --dump-blocknos=<output name> ]
@@ -824,6 +825,7 @@ Usage: btt 2.05
 [ -V               | --version ]
 [ -v               | --verbose ]
 [ -X               | --easy-parse-avgs ]
+[ -z <output name> | --q2d-latencies=<output name> ]
 \end{verbatim}
 
 \subsection{\label{sec:o-a}\texttt{--seek-absolute}/\texttt{-a}}
@@ -1094,6 +1096,11 @@ UPG 8,16 1.993361748 1.866492147
 ARQ 8,16 12.938165321
   \end{verbatim}
 
+\subsection{\label{sec:o-z}\texttt{--q2d-latencies}/\texttt{-l}}
+
+  This option instructs \texttt{btt} to generate the Q2D latency file
+  discussed in section~\ref{sec:lat-q2d}.
+
 \newpage\section{\label{sec:bno_plot}bno\_plot.py}
 
 Included with the distribution is a simple 3D plotting utility based
index 8b804ee690d64c0c51d13af8c1aeac040923a7b8..a901b52283d2d275b432bd765ca6c0da32121f01 100644 (file)
@@ -146,8 +146,9 @@ struct d_info {
        struct region_info regions;
        struct devmap *map;
        void *q2q_handle, *seek_handle, *bno_dump_handle, *unplug_hist_handle;
-       void *q2d_priv, *aqd_handle, *q2c_plat_handle, *d2c_plat_handle;
-       FILE *d2c_ofp, *q2c_ofp;
+       void *q2d_priv, *aqd_handle;
+       void *q2d_plat_handle, *q2c_plat_handle, *d2c_plat_handle;
+       FILE *q2d_ofp, *d2c_ofp, *q2c_ofp;
        struct avgs_info avgs;
        struct stats stats, all_stats;
        __u64 last_q, n_qs, n_ds;
@@ -180,7 +181,7 @@ struct io {
 
 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, *aqd_name;
+extern char *bno_dump_name, *unplug_hist_name, *sps_name, *aqd_name, *q2d_name;
 extern double range_delta, plat_freq;
 extern FILE *ranges_ofp, *avgs_ofp, *xavgs_ofp, *iostat_ofp, *per_io_ofp;
 extern FILE *msgs_ofp;
@@ -249,6 +250,7 @@ void iostat_dump_stats(__u64 stamp, int all);
 /* latency.c */
 void latency_init(struct d_info *dip);
 void latency_clean(void);
+void latency_q2d(struct d_info *dip, __u64 tstamp, __u64 latency);
 void latency_d2c(struct d_info *dip, __u64 tstamp, __u64 latency);
 void latency_q2c(struct d_info *dip, __u64 tstamp, __u64 latency);
 
index 4fb02d5c27da772045211b696017f8858c8d3451..0c6e55d422d058a91c83ffba8c1beae76174ae14 100644 (file)
@@ -51,6 +51,7 @@ FILE *latency_open(__u32 device, char *name, char *post)
 
 void latency_init(struct d_info *dip)
 {
+       dip->q2d_ofp = latency_open(dip->device, q2d_name, "q2d");
        dip->d2c_ofp = latency_open(dip->device, d2c_name, "d2c");
        dip->q2c_ofp = latency_open(dip->device, q2c_name, "q2c");
 }
@@ -60,6 +61,12 @@ void latency_clean(void)
        clean_files(&all_files);
 }
 
+void latency_q2d(struct d_info *dip, __u64 tstamp, __u64 latency)
+{
+       plat_x2c(dip->q2d_plat_handle, tstamp, latency);
+       latency_out(dip->q2d_ofp, tstamp, latency);
+}
+
 void latency_d2c(struct d_info *dip, __u64 tstamp, __u64 latency)
 {
        plat_x2c(dip->d2c_plat_handle, tstamp, latency);
index b7c3e5f4efd05503d334802dd39e60104f7d6a71..976fe1c3736f2065944c95a3de60a17a406ddad6 100644 (file)
@@ -55,6 +55,8 @@ static void handle_issue(struct io *d_iop)
                if (output_all_data)
                        q2d_histo_add(q_iop->dip->q2d_priv,
                                                d_iop->t.time - q_iop->t.time);
+               latency_q2d(q_iop->dip, d_iop->t.time, 
+                                               d_iop->t.time - q_iop->t.time);
        }
 }
 
index 55bc62aacf3935b0aef6f684fdf401e4b3cd9ed6..6f6fbdb2fc23cd34fee5ef86014108965456493e 100644 (file)
--- a/doc/btt.1
+++ b/doc/btt.1
@@ -52,6 +52,8 @@ btt \- analyse block i/o traces produces by blktrace
 [ \-v               | \-\-verbose ]
 .br
 [ \-V               | \-\-version ]
+.br
+[ \-z <\fIoutput name\fR> | \-\-q2d\-latencies=<\fIoutput name\fR> ]
 
 
 .SH DESCRIPTION
@@ -306,10 +308,19 @@ Shows the version of btt.
 Requests a more verbose output.
 .RE
 
+.B \-z <\fIoutput name\fR>
+.br
+.B \-\-q2d\-latencies=<\fIoutput name\fR>
+.RS 4
+The \-z option allows one to output per\-IO Q2D latencies
+respectively. The supplied argument provides the basis for the output
+name for each device.
+.RE
+
 
 .SH AUTHORS
-\fIblkparse\fR was written by Jens Axboe, Alan D. Brunelle and Nathan Scott.  This
-man page was created from the \fIblktrace\fR documentation by Bas Zoetekouw.
+\fIbtt\fR was written by Alan D. Brunelle.  This man page was created
+from the \fIblktrace\fR documentation by Bas Zoetekouw.
 
 
 .SH "REPORTING BUGS"