Add in option to change seek distance calculations
PATCH 1/1 Add in option to change seek distance calculations
See the updated doc for details.
From: Alan D. Brunelle <[email protected]>
Add in option to have seeks be start-to-start, rather than closest
Signed-off-by Alan D. Brunelle <[email protected]>
---
btt/args.c | 11 ++++++++++- btt/bt_timeline.c | 2 +- btt/doc/btt.tex | 28 ++++++++++++++++++++++++++-- btt/globals.h | 2 +- btt/seek.c | 19 ++++++++++++------- 5 files changed, 50 insertions(+), 12 deletions(-)
btt/args.c +10 -1
@@ -29,9 +29,15 @@#define SETBUFFER_SIZE (64 * 1024) -#define S_OPTS "AB: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:Vv"static struct option l_opts[] = { { + .name ="seek-absolute" , + .has_arg = no_argument, + .flag =NULL , + .val ='a' + }, + { .name ="all-data" , .has_arg = no_argument, .flag =NULL ,
@@ -213,6 +219,9 @@ void handle_args(int argc, char *argv[])while ((c =getopt_long (argc, argv,S_OPTS , l_opts,NULL )) !=-1 ) {switch (c) { +case 'a' : + seek_absolute =1 ; +break ;case 'A' : output_all_data =1 ;break ;
btt/bt_timeline.c +1 -1
@@ -30,7 +30,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;FILE *ranges_ofp, *avgs_ofp, *per_io_ofp; -int verbose, done, time_bounded, output_all_data; +int verbose, done, time_bounded, output_all_data, seek_absolute;double t_astart, t_aend;unsigned long n_traces;struct avgs_info all_avgs;
btt/doc/btt.tex +26 -2
@@ -1,5 +1,5 @@ \documentclass{article} -\usepackage{epsfig} +\usepackage{epsfig,placeins} % % Copyright (C) 2007 Alan D. Brunelle <[email protected]>
@@ -22,7 +22,7 @@ \title{\texttt{btt} User Guide} \author{Alan D. Brunelle ([email protected])} -\date{1 March 2007} +\date{10 April 2007} \begin{document} \maketitle
@@ -591,11 +591,27 @@ Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s \epsfig{file=seek.eps,width=4.5in} \caption{\label{fig:seek}Seek Chart} \end{figure} + \FloatBarrier + + The seek difference is calculated in one of two ways: + + \begin{description} + \item[default] By default, the seek distance is calculated as the + \emph{closest} distance between the previous IO and this IO. The + concept of \emph{closeness} means that it could either be the + \emph{end} of the previous IO and the beginning of the next, or the + end of this IO and the start of the next. + + \item[\texttt{-a}] If the \texttt{-a} or \texttt{seek-absolute} + option is specified, then the seek distance is simply the difference + between the start of the previous IO and the start of this IO. + \end{description} \newpage\section{\label{sec:cmd-line}Command Line} \begin{verbatim} Usage: \texttt{btt} 0.99.1 +[ -a | --seek-absolute ] [ -A | --all-data ] [ -B <output name> | --dump-blocknos=<output name> ] [ -d <seconds> | --range-delta=<seconds> ]
@@ -617,6 +633,14 @@ Usage: \texttt{btt} 0.99.1 [ -v | --verbose ] \end{verbatim} +\subsection{\label{sec:o-a}\texttt{--seek-absolute}/\texttt{-a}} + + When specified on the command line, this directs btt to calculate seek + distances based solely upon the starting block addresses of succeeding + IOs. By default \texttt{btt} uses the concept of the closeness to either + the beginning or end of the previous IO. See section~\ref{sec:seek} + for more details about seek distances. + \subsection{\label{sec:o-A}\texttt{--all-data}/\texttt{-A}} Normally \texttt{btt} will not print out verbose information
btt/globals.h +1 -1
@@ -199,7 +199,7 @@ extern char *seek_name, *iostat_name, *d2c_name, *q2c_name, *per_io_name;extern char *bno_dump_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; +extern int verbose, done, time_bounded, output_all_data, seek_absolute;extern unsigned int n_devs;extern unsigned long n_traces;extern struct list_head all_devs, all_procs, retries, rmhd;
btt/seek.c +12 -7
@@ -105,14 +105,19 @@ long long seek_dist(struct seeki *sip, struct io *iop)long long dist;long long start =BIT_START (iop), end =BIT_END (iop); -/* Some overlap means no seek */ -if (((sip->last_start <= start) && (start <= sip->last_end)) || - ((sip->last_start <= end) && (end <= sip->last_end))) - dist =0 ; -else if (start > sip->last_end) - dist = start - sip->last_end; -else +if (seek_absolute) dist = start - sip->last_start; +else { +/* Some overlap means no seek */ +if (((sip->last_start <= start) && (start <= sip->last_end)) || + ((sip->last_start <= end) && (end <= sip->last_end))) + dist =0 ; +else if (start > sip->last_end) + dist = start - sip->last_end; +else + dist = start - sip->last_start; + + } sip->last_start = start; sip->last_end = end;
Quoted 13 lines · Alan D. Brunelle
btt/doc/btt.tex +6
-0+ + \begin{description} + \item[default] By default, the seek distance is calculated as the + \emph{closest} distance between the previous IO and this IO. The + concept of \emph{closeness} means that it could either be the + \emph{end} of the previous IO and the beginning of the next, orthe
btt/doc/btt.tex +4
-0+ end of this IO and the start of the next. + + \item[\texttt{-a}] If the \texttt{-a} or \texttt{seek-absolute} + option is specified, then the seek distance is simply thedifference
btt/doc/btt.tex Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s · line 608
Quoted 2 lines
btt/doc/btt.tex +2
-0+ between the start of the previous IO and the start of this IO. + \end{description}
a typo? the distance between 2 start? or end of previous IO and start of this IO?
Ming