Skip to contentSkip to conversation

Added in -L option - output periodic latency information

PATCH New Alan D. Brunelle 1 participant 1 message Oct 16, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Added in -L option - output periodic latency information

Jens:

Pushed successfully...

Alan

From 2baef5087c57d39ee2fc488cd52348f61f32b1fc Mon Sep 17 00:00:00 2001
From: Alan D. Brunelle <[email protected]>
Date: Thu, 16 Oct 2008 12:03:45 -0400
Subject: [PATCH] Added in -L option - output periodic latency information

---
 btt/Makefile      |    2 +-
 btt/aqd.c         |   10 +++++
 btt/args.c        |   12 ++++++-
 btt/bt_timeline.c |    2 +
 btt/devs.c        |    7 ++++
 btt/doc/btt.tex   |    7 ++++
 btt/globals.h     |   12 +++++-
 btt/latency.c     |    2 +
 btt/plat.c        |  102 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 doc/btt.1         |   11 ++++++
 10 files changed, 163 insertions(+), 4 deletions(-)
 create mode 100644 btt/plat.c
btt/Makefile +1 -1
index 8c4d882..1f6dacc 100644
@@ -17,7 +17,7 @@ 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 \
-	  aqd.o
+	  aqd.o plat.o
 
 all: depend $(PROGS)
 
btt/aqd.c +10 -0
index 036a0d3..775fca6 100644
@@ -53,6 +53,16 @@ void *aqd_init(char *str)
 
 }
 
+void aqd_exit(void *info)
+{
+	free(info);
+}
+
+void aqd_clean(void)
+{
+	clean_files(&aqd_files);
+}
+
 void aqd_issue(void *info, double ts)
 {
 	struct aqd_info *ap = info;
btt/args.c +11 -1
index 2cbbf54..db4186e 100644
@@ -29,7 +29,7 @@
 
 #define SETBUFFER_SIZE	(64 * 1024)
 
-#define S_OPTS	"aAB:d:D:e:hi:I: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:VvX"
 static struct option l_opts[] = {
 	{
 		.name = "seek-absolute",
@@ -92,6 +92,12 @@ static struct option l_opts[] = {
 		.val = 'l'
 	},
 	{
+		.name = "periodic-latencies",
+		.has_arg = required_argument,
+		.flag = NULL,
+		.val = 'L'
+	},
+	{
 		.name = "seeks-per-second",
 		.has_arg = required_argument,
 		.flag = NULL,
@@ -191,6 +197,7 @@ static char usage_str[] = \
 	"[ -i <input name>  | --input-file=<input name> ]\n" \
 	"[ -I <output name> | --iostat=<output name> ]\n" \
 	"[ -l <output name> | --d2c-latencies=<output name> ]\n" \
+	"[ -L <freq>        | --periodic-latencies=<freq> ]\n" \
 	"[ -m <output name> | --seeks-per-second=<output name> ]\n" \
 	"[ -M <dev map>     | --dev-maps=<dev map>\n" \
 	"[ -o <output name> | --output-file=<output name> ]\n" \
@@ -275,6 +282,9 @@ void handle_args(int argc, char *argv[])
 		case 'l':
 			d2c_name = strdup(optarg);
 			break;
+		case 'L':
+			plat_freq = atof(optarg);
+			break;
 		case 'I':
 			iostat_name = strdup(optarg);
 			break;
btt/bt_timeline.c +2 -0
index c4bbfbf..75e41ca 100644
@@ -45,6 +45,7 @@ LIST_HEAD(free_ios);
 LIST_HEAD(free_bilinks);
 __u64 q_histo[N_HIST_BKTS], d_histo[N_HIST_BKTS];
 
+double plat_freq = 0.0;
 double range_delta = 0.1;
 __u64 last_q = (__u64)-1;
 
@@ -82,6 +83,7 @@ int main(int argc, char *argv[])
 	dip_exit();
 	seek_clean();
 	pip_exit();
+	aqd_clean();
 	io_free_all();
 	region_exit(&all_regions);
 
btt/devs.c +7 -0
index 2127cde..b7943d3 100644
@@ -85,6 +85,9 @@ void dip_exit(void)
 		region_exit(&dip->regions);
 		seeki_exit(dip->seek_handle);
 		seeki_exit(dip->q2q_handle);
+		aqd_exit(dip->aqd_handle);
+		plat_exit(dip->q2c_plat_handle);
+		plat_exit(dip->d2c_plat_handle);
 		bno_dump_exit(dip->bno_dump_handle);
 		unplug_hist_exit(dip->unplug_hist_handle);
 		if (output_all_data)
@@ -121,6 +124,10 @@ 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->q2c_plat_handle =
+				plat_init(mkhandle(str, device, "_q2c_plat"));
+		dip->d2c_plat_handle =
+				plat_init(mkhandle(str, device, "_d2c_plat"));
 		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 +7 -0
index aa7db8c..eb4d29a 100644
@@ -809,6 +809,7 @@ Usage: btt 2.05
 [ -i <input name>  | --input-file=<input name> ]
 [ -I <output name> | --iostat=<output name> ]
 [ -l <output name> | --d2c-latencies=<output name> ]
+[ -L <freq>        | --periodic-latencies=<freq> ]
 [ -m <output name> | --seeks-per-second=<output name> ]
 [ -M <dev map>     | --dev-maps=<dev map>
 [ -o <output name> | --output-file=<output name> ]
@@ -907,6 +908,12 @@ Usage: btt 2.05
   This option instructs \texttt{btt} to generate the D2C latency file
   discussed in section~\ref{sec:lat-d2c}.
 
+\subsection{\label{sec:o-L}\texttt{--periodic-latencies}/\texttt{-L}}
+
+  When given a value greater than 0, this option will create two data
+  files (q2c \& d2c) per device containing a periodic timestamp \&
+  average latency over that period.
+
 \subsection{\label{sec:o-m}\texttt{--seeks-per-second}\texttt{-m}}
 
   Tells \texttt{btt} to output seeks per second information.  Each device
btt/globals.h +10 -2
index bf1d656..8b804ee 100644
@@ -146,7 +146,7 @@ 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;
+	void *q2d_priv, *aqd_handle, *q2c_plat_handle, *d2c_plat_handle;
 	FILE *d2c_ofp, *q2c_ofp;
 	struct avgs_info avgs;
 	struct stats stats, all_stats;
@@ -181,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 double range_delta;
+extern double range_delta, plat_freq;
 extern FILE *ranges_ofp, *avgs_ofp, *xavgs_ofp, *iostat_ofp, *per_io_ofp;
 extern FILE *msgs_ofp;
 extern int verbose, done, time_bounded, output_all_data, seek_absolute;
@@ -204,6 +204,8 @@ void clean_args();
 
 /* aqd.c */
 void *aqd_init(char *str);
+void aqd_exit(void *info);
+void aqd_clean(void);
 void aqd_issue(void *info, double ts);
 void aqd_complete(void *info, double ts);
 
@@ -282,6 +284,12 @@ void bno_dump_exit(void *param);
 void bno_dump_add(void *handle, struct io *iop);
 void bno_dump_clean(void);
 
+/* plat.c */
+void *plat_init(char *str);
+void plat_exit(void *info);
+void plat_clean(void);
+void plat_x2c(void *info, __u64 ts, __u64 latency);
+
 /* q2d.c */
 void q2d_histo_add(void *priv, __u64 q2d);
 void *q2d_init(void);
btt/latency.c +2 -0
index 916f566..4fb02d5 100644
@@ -62,10 +62,12 @@ void latency_clean(void)
 
 void latency_d2c(struct d_info *dip, __u64 tstamp, __u64 latency)
 {
+	plat_x2c(dip->d2c_plat_handle, tstamp, latency);
 	latency_out(dip->d2c_ofp, tstamp, latency);
 }
 
 void latency_q2c(struct d_info *dip, __u64 tstamp, __u64 latency)
 {
+	plat_x2c(dip->q2c_plat_handle, tstamp, latency);
 	latency_out(dip->q2c_ofp, tstamp, latency);
 }
btt/plat.c new file +102 -0

102 lines not on this page · raw message

doc/btt.1 +11 -0
index 84275a5..55bc62a 100644
@@ -27,6 +27,8 @@ btt \- analyse block i/o traces produces by blktrace
 .br
 [ \-l <\fIoutput name\fR> | \-\-d2c\-latencies=<\fIoutput name\fR> ]
 .br
+[ \-L <\fIfreq\fR>        | \-\-periodic\-latencies=<\fIfreq\fR> ]
+.br
 [ \-M <\fIdev map\fR>     | \-\-dev\-maps=<\fIdev map\fR>
 .br
 [ \-o <\fIoutput name\fR> | \-\-output\-file=<\fIoutput name\fR> ]
@@ -181,6 +183,15 @@ respectively. The supplied argument provides the basis for the output
 name for each device.
 .RE
 
+.B \-L <\fIfreq\fR>
+.br
+.B \-\-periodic\-latencies=<\fIfreq\fR>
+.RS 4
+The \-L option allows one to output periodic latency information for both
+Q2C and D2C latencies. The frequency specified will regulate how often
+an average latency is output -- a floating point value expressing seconds.
+.RE
+
 .B \-M <\fIdev map\fR>
 .br
 .B \-\-dev\-maps=<\fIdev map\fR>
Signature · 1 line
1.5.4.3