Skip to contentSkip to conversation

Misc fixes to seek output

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

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Misc fixes to seek output

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

Converted seek output for absolute to be end-to-start, and added rw on out

---

 btt/doc/btt.tex |   14 +++++++-------
 btt/seek.c      |    9 +++++----
 2 files changed, 12 insertions(+), 11 deletions(-)
btt/doc/btt.tex +7 -7
index ced747d..26cba36 100644
@@ -602,9 +602,9 @@ Device:       rrqm/s   wrqm/s     r/s     w/s    rsec/s    wsec/s
     \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}
+    \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.
+    between the end of the previous IO and the start of this IO.
   \end{description}
 
 \newpage\section{\label{sec:cmd-line}Command Line}
@@ -635,11 +635,11 @@ Usage: \texttt{btt} 0.99.1
 
 \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.
+  When specified on the command line, this directs btt to calculate
+  seek distances based solely upon the ending block address of one IO,
+  and the start of the next.  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}}
 
btt/seek.c +5 -4
index b8a3d42..8738698 100644
@@ -106,7 +106,7 @@ long long seek_dist(struct seeki *sip, struct io *iop)
 	long long start = BIT_START(iop), end = BIT_END(iop);
 
 	if (seek_absolute)
-		dist = start - sip->last_start;
+		dist = start - sip->last_end;
 	else {
 		/* Some overlap means no seek */
 		if (((sip->last_start <= start) && (start <= sip->last_end)) ||
@@ -153,14 +153,15 @@ void seeki_exit(void *param)
 void seeki_add(void *handle, struct io *iop)
 {
 	struct seeki *sip = handle;
+	char rw = IOP_READ(iop) ? 'r' : 'w';
 	long long dist = seek_dist(sip, iop);
-	FILE *fp = IOP_READ(iop) ? sip->rfp : sip->wfp;
 	double tstamp = BIT_TIME(iop->t.time);
+	FILE *fp = IOP_READ(iop) ? sip->rfp : sip->wfp;
 
 	if (fp)
-		fprintf(fp, "%15.9lf %13lld\n", tstamp, dist);
+		fprintf(fp, "%15.9lf %13lld %c\n", tstamp, dist, rw);
 	if (sip->cfp)
-		fprintf(sip->cfp, "%15.9lf %13lld\n", tstamp, dist);
+		fprintf(sip->cfp, "%15.9lf %13lld %c\n", tstamp, dist, rw);
 
 	dist = llabs(dist);
 	sip->tot_seeks++;