Skip to contentSkip to conversation

Add in unplug IO count histogram option

PATCH New Alan D. Brunelle 1 participant 1 message Apr 16, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add in unplug IO count histogram option

From: Alan D. Brunelle <[email protected]>

Add in unplug IO count histogram

---

 btt/Makefile      |    2 +
 btt/args.c        |   12 ++++++-
 btt/bt_timeline.c |    2 +
 btt/devs.c        |    2 +
 btt/doc/btt.tex   |   36 +++++++++++++++++++--
 btt/globals.h     |    9 ++++-
 btt/trace_plug.c  |    1 +
 btt/unplug_hist.c |   90 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 8 files changed, 146 insertions(+), 8 deletions(-)
btt/Makefile +1 -1
index 920c70c..e9a1ef0 100644
@@ -16,7 +16,7 @@ LIBS	= $(PLIBS) $(ELIBS)
 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
+	  mmap.o trace_plug.o bno_dump.o unplug_hist.o
 
 all: depend $(PROGS)
 
btt/args.c +11 -1
index 7a4a5fd..9e918c9 100644
@@ -29,7 +29,7 @@
 
 #define SETBUFFER_SIZE	(64 * 1024)
 
-#define S_OPTS	"aAB:d:D:e:hi:I:l:M:o:p:q:s:S:t:T:Vv"
+#define S_OPTS	"aAB:d:D:e:hi:I:l:M:o:p:q:s:S:t:T:u:Vv"
 static struct option l_opts[] = {
 	{
 		.name = "seek-absolute",
@@ -140,6 +140,12 @@ static struct option l_opts[] = {
 		.val = 'T'
 	},
 	{
+		.name = "unplug-hist",
+		.has_arg = required_argument,
+		.flag = NULL,
+		.val = 'u'
+	},
+	{
 		.name = "version",
 		.has_arg = no_argument,
 		.flag = NULL,
@@ -175,6 +181,7 @@ static char usage_str[] = \
 	"[ -S <interval>    | --iostat-interval=<interval> ]\n" \
 	"[ -t <sec>         | --time-start=<sec> ]\n" \
 	"[ -T <sec>         | --time-end=<sec> ]\n" \
+	"[ -u <output name> | --unplug-hist=<output name> ] \n" \
 	"[ -V               | --version ]\n" \
 	"[ -v               | --verbose ]\n\n";
 
@@ -280,6 +287,9 @@ void handle_args(int argc, char *argv[])
 			sscanf(optarg, "%lf", &t_aend);
 			time_bounded = 1;
 			break;
+		case 'u':
+			unplug_hist_name = strdup(optarg);
+			break;
 		case 'v':
 			verbose = 1;
 			break;
btt/bt_timeline.c +1 -1
index 76676a3..f38f6a2 100644
@@ -28,7 +28,7 @@
 char bt_timeline_version[] = "0.99.1";
 
 char *devices, *exes, *input_name, *output_name, *seek_name, *bno_dump_name;
-char *d2c_name, *q2c_name, *per_io_name;
+char *d2c_name, *q2c_name, *per_io_name, *unplug_hist_name;
 FILE *ranges_ofp, *avgs_ofp, *per_io_ofp;
 int verbose, done, time_bounded, output_all_data, seek_absolute;
 double t_astart, t_aend;
btt/devs.c +2 -0
index 9eece81..397a945 100644
@@ -134,6 +134,7 @@ void dip_exit(void)
 		region_exit(&dip->regions);
 		seeki_exit(dip->seek_handle);
 		bno_dump_exit(dip->bno_dump_handle);
+		unplug_hist_exit(dip->unplug_hist_handle);
 		free(dip);
 	}
 }
@@ -152,6 +153,7 @@ struct d_info *dip_add(__u32 device, struct io *iop)
 		dip->map = dev_map_find(device);
 		dip->seek_handle = seeki_init(device);
 		dip->bno_dump_handle = bno_dump_init(device);
+		dip->unplug_hist_handle = unplug_hist_init(device);
 		latency_init(dip);
 		list_add_tail(&dip->hash_head, &dev_heads[DEV_HASH(device)]);
 		list_add_tail(&dip->all_head, &all_devs);
btt/doc/btt.tex +33 -3
index 26cba36..e8762e8 100644
@@ -22,7 +22,7 @@
 
 \title{\texttt{btt} User Guide}
 \author{Alan D. Brunelle ([email protected])}
-\date{10 April 2007}
+\date{16 April 2007}
 
 \begin{document}
 \maketitle
@@ -346,6 +346,10 @@ pdflush       0.000000790 0.000006752 0.247231307  179791
     \item[seek details] A data file containing all IO-to-IO
     sector differences can be output, with details found in
     section~\ref{sec:seek}.
+
+    \item[unplug histogram details] A data file per device containing
+    histogram output for the amount of IOs released at unplug time.
+    Section~\ref{sec:o-u} has more details.
   \end{description}
 
 \newpage\section{\label{sec:activity}Activity Data File}
@@ -629,6 +633,7 @@ Usage: \texttt{btt} 0.99.1
 [ -S <interval>    | --iostat-interval=<interval> ]
 [ -t <sec>         | --time-start=<sec> ]
 [ -T <sec>         | --time-end=<sec> ]
+[ -u <output name> | --unplug-hist=<output name> ] 
 [ -V               | --version ]
 [ -v               | --verbose ]
 \end{verbatim}
@@ -737,7 +742,7 @@ Usage: \texttt{btt} 0.99.1
 
 \subsection{\label{sec:o-s}\texttt{--seeks}/\texttt{-s}}
 
-  This option instruct \texttt{btt} to generate the seek data file
+  This option instructs \texttt{btt} to generate the seek data file
   discussed in section~\ref{sec:seek}.
 
 \subsection{\label{sec:o-S}\texttt{--iostat-interval}/\texttt{-S}}
@@ -761,6 +766,31 @@ Usage: \texttt{btt} 0.99.1
   trace chosen will be between the start time (or 0.0 if not
   specified) and end time (or the end of the run) specified. 
 
+\subsection{\label{sec:o-u}\texttt{--unplug-hist}/\texttt{-u}}
+
+  This option instructs \texttt{btt} to generate a data file containing
+  histogram information for \emph{unplug} traces on a per device
+  basis. It shows how many times an unplug was hit with a specified
+  number of IOs released. There are 21 output values into the file, as
+  follows:
+
+  \medskip
+  \begin{tabular}{ll}
+\textbf{X value} & \textbf{Representing Counts} \\\hline
+0 & 0\dots\/4 \\
+1 & 5\dots\/9 \\
+2 & 10\dots\/14 \\
+\dots & \dots\dots\\
+19 & 95\dots\/99 \\
+20 & 100+ \\
+  \end{tabular}
+
+  \medskip
+  The file name(s) generated use the text string passed as an argument for
+  the prefix, followed by the device identifier in \texttt{major,minor}
+  form, with a \texttt{.dat} extension (as an example, with \texttt{-u
+  up\_hist} specified on the command line: \texttt{up\_hist\_008,032.dat}.
+
 \subsection{\label{sec:o-V}\texttt{--version}/\texttt{-V}}
 
   Prints out the \texttt{btt} version, and exits.
@@ -788,7 +818,7 @@ Sending stats data to bttX.avg
 16.379036+0.000005=16.379041
 \end{verbatim}
 
-\newpage\section{\label{sec:appendix}Appendix: Sample \texttt{btt}
+\newpage\section*{\label{sec:appendix}Appendix: Sample \texttt{btt}
 Output}
   
   Here is a complete output file from a btt run, illustrating a lot of the
btt/globals.h +7 -2
index ad50917..5a6982f 100644
@@ -158,7 +158,7 @@ struct d_info {
 	void *heads;
 	struct region_info regions;
 	struct devmap *map;
-	void *seek_handle, *bno_dump_handle;
+	void *seek_handle, *bno_dump_handle, *unplug_hist_handle;
 	FILE *d2c_ofp, *q2c_ofp;
 	struct avgs_info avgs;
 	struct stats stats, all_stats;
@@ -196,7 +196,7 @@ struct bilink {
 
 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;
+extern char *bno_dump_name, *unplug_hist_name;
 extern double range_delta;
 extern FILE *ranges_ofp, *avgs_ofp, *iostat_ofp, *per_io_ofp;
 extern int verbose, done, time_bounded, output_all_data, seek_absolute;
@@ -350,4 +350,9 @@ void trace_remap(struct io *a_iop);
 /* trace_requeue.c */
 void trace_requeue(struct io *r_iop);
 
+/* unplug_hist.c */
+void *unplug_hist_init(__u32 device);
+void unplug_hist_exit(void *arg);
+void unplug_hist_add(struct io *u_iop);
+
 #include "inlines.h"
btt/trace_plug.c +1 -0
index dd797f6..06d9fc9 100644
@@ -22,6 +22,7 @@
 
 static inline void trace_unplug(struct io *u_iop, int is_timer)
 {
+	unplug_hist_add(u_iop);
 	dip_unplug(u_iop->t.device, BIT_TIME(u_iop->t.time), is_timer);
 	io_release(u_iop);
 }
btt/unplug_hist.c new file +90 -0

90 lines not on this page · raw message