1 \documentclass{article}
2 \usepackage{epsfig,placeins}
5 % Copyright (C) 2007 Alan D. Brunelle <Alan.Brunelle@hp.com>
7 % This program is free software; you can redistribute it and/or modify
8 % it under the terms of the GNU General Public License as published by
9 % the Free Software Foundation; either version 2 of the License, or
10 % (at your option) any later version.
12 % This program is distributed in the hope that it will be useful,
13 % but WITHOUT ANY WARRANTY; without even the implied warranty of
14 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 % GNU General Public License for more details.
17 % You should have received a copy of the GNU General Public License
18 % along with this program; if not, write to the Free Software
19 % Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 % vi :set textwidth=75
23 \title{\texttt{btt} User Guide}
24 \author{Alan D. Brunelle (Alan.Brunelle@hp.com)}
30 \section{\label{sec:intro}Introduction}
32 \texttt{btt} is a post-processing tool for the block layer IO tracing
33 tool called blktrace. As noted in its Users Guide, blktrace
36 is a block layer IO tracing mechanism which provides detailed
37 information about request queue operations up to user space.
40 blktrace is capable of producing tremendous amounts of output in the
41 form of multiple individual traces per IO executed during the traced
42 run. It is also capable of producing some general statistics concerning
43 IO rates and the like. \texttt{btt} goes further and produces a variety
44 of overall statistics about each of the individual handling of IOs, and
45 provides data we believe is useful to plot to provide visual comparisons
48 This document will discuss \texttt{btt} usage, provide some sample output,
49 and also show some interesting plots generated from the data provided
50 by the \texttt{btt} utility.
53 A short note on the ordering of this document -- the actual
54 command-line usage section occurs relatively late in the document (see
55 section~\ref{sec:cmd-line}), as we felt that discussing some of the
56 capabilities and output formats would make the parameter discussion
60 This document refers to the output formats generated by \texttt{btt}
61 version 2.00. However, the descriptions are general enough to cover
62 output formats prior to that.
64 \newpage\tableofcontents
66 \newpage\section{\label{sec:getting-started}Getting Started}
68 The simple pipeline to get going with \texttt{btt} is to perform the
72 \item Run \texttt{blktrace}, specifying whatever devices and other
73 parameters you want. You must save the traces to disk in this step,
74 btt does not work in live mode.
76 \item After tracing completes, run \texttt{blkrawverify}, specifying
77 all devices that were traced (or at least on all devices that you
78 will use \texttt{btt} with -- section~\ref{sec:o-D} shows how you
79 can dictate which devices to use with btt). If blkrawverify finds
80 errors in the trace streams saved, it is best to recapture the data
81 -- utilizing \texttt{btt} on \emph{unclean} trace files produces
84 While this step is optional, we have found that performing this
85 helps to ensure data coming from \texttt{btt} makes the most sense.
87 \item Run \texttt{blkparse} with the \texttt{-d} option specifying
88 a file to store the combined binary stream. (e.g.: \texttt{blkparse
91 \texttt{blktrace} produces a series of binary files
92 containing parallel trace streams -- one file per CPU per
93 device. \texttt{blkparse} provides the ability to combine all the
94 files into one time-ordered stream of traces for all devices.
96 \item Run \texttt{btt} specifying the file produced by
97 \texttt{blkparse} utilizing the \texttt{-i} option (e.g.: \texttt{btt
102 \newpage\section{\label{sec:output-overview}Output Overview}
104 The major default areas of output provided by \texttt{btt}
105 include\label{tl-defs}:
108 \item[average component times across all IOs] The time line of each IO
109 is broken down into 3 major regions:
112 \item Time needed to insert or merge an incoming IO onto the request
113 queue. This is the average time from when the IO enters the block
114 IO layer (queue trace) until it is inserted (insert trace).
116 This is denoted as \emph{Q2I} time.
118 This is also broken down into two component times\footnote{On
119 occasion there are also some time spent \emph{sleeping} waiting
120 for a request. That occurs between the Q and G operations. You
121 will see these listed as \texttt{S2G} times.}:
124 \item[Q2G] Time needed to \emph{get} a request (get request
127 \item[G2I] Time needed to put that request onto the request
128 queue (insert trace).
131 For \emph{merged} requests -- an incoming request that is merged
132 with a previously submitted request -- we calculate \emph{Q2M}, the
133 amount of time between the queue trace and the merge trace.
135 \item Time spent on the request queue. The average time from when
136 the IO is inserted or merged onto the request queue, until it is
137 issued (issue trace) to the lower level driver.
139 Referred to as \emph{I2D} time\footnote{The \emph{issue} trace
140 is represented by a D in the blkparse output, hence its usage in
141 btt to refer to issue traces. Note that an I is used to refer to
142 \emph{insert} traces.}.
144 \item Driver and device time -- the average time from when the
145 actual IO was issued to the driver until is completed (completion
146 trace) back to the block IO layer.
148 This is referred to as the \emph{D2C} time\
151 Two other sets of results are presented in this section:
154 \item \emph{Q2Q} which measures the time between queue traces
155 in the system. This provides some idea as to how quickly IOs are
156 being handed to the block IO layer.
158 \item \emph{Q2C} which measures the times for the complete life cycle
159 of IOs during the run\footnote{One of the areas that needs some
160 work in \texttt{btt} is to better understand the multiplex nature of
161 IOs during a run. In theory, one would like ${Q2I} + {I2D} + {D2C}
162 = {Q2C}$ however, typically there are multiple queue traces that
163 are combined via merges into a single IO issued and completed. We
164 currently average the queue-to-insert and queue-to-merge times,
165 and thus tend to be quite close to the expected equation.}
169 For each row in this output, we provide a minimum, average, maximum
170 (which are all presented in seconds), and overall count. As an
171 example\footnote{As with this display, the author has taken some liberty
172 in reformatting the output for better display on the printed page.}:
176 ---- ------------- ------------- ------------- -----------
177 Q2Q 0.000000058 0.000012761 9.547941661 2262310
178 Q2I 0.000000272 0.000005995 0.104588839 2262311
179 I2D 0.000001446 0.094992714 0.239636864 2262311
180 D2C 0.000193721 0.030406554 1.634221408 2262311
181 Q2C 0.000207665 0.125405263 1.830917198 2262311
184 When tracking \emph{device mapper} devices, we also break down the
185 \emph{Q2A} and \emph{Q2C} times for those IOs.
187 \item[Device Overhead]
189 Using the data from the previous chart, we can then provide some idea
190 as to where IO spend most of the time on average. The following output
191 shows the percentage of time spent in each of the phases of an
192 IO\footnote{It should be noted that incoming requests either go through:
201 before proceeding to I2D and D2C.}
204 DEV | Q2G G2I Q2M I2D D2C
205 ---------- | --------- --------- --------- --------- ---------
206 ( 8, 80) | 0.0013% 0.0004% 0.0006% 88.5005% 11.4988%
207 ---------- | --------- --------- --------- --------- ---------
208 Overall | 0.0003% 0.0001% 0.0041% 21.4998% 78.4958%
211 \item[Device Merge Information]
213 A key measurement when making changes in the system (software \emph{or}
214 hardware) is to understand the block IO layer ends up merging incoming
215 requests into fewer, but larger, IOs to the underlying driver. In this
216 section, we show the number of incoming requests (Q), the number of
217 issued requests (D) and the resultant ratio. We also provide values
218 for the minimum, average and maximum IOs generated.
220 Looking at the following example:
223 DEV | #Q #D Ratio | BLKmin BLKavg BLKmax Total
224 ---------- | ------- ----- ----- | ------ ------ ------ -------
225 ( 68, 64) | 2262311 18178 124.5 | 2 124 128 2262382
228 we see that (on average) the block IO layer is combining upwards of
229 125 incoming requests into a single request down the IO stack. The
230 resultant average IO size is 124 blocks.
232 \item[Device Seek Information]
234 Another useful measure is the variability in the sector distances
235 between consecutively \emph{received -- queued} and \emph{submitted
236 -- issued} IOs. The next two sections provides some rudimentary
237 statistics to gauge the general nature of the sector differences
238 between IOs. Values provided include the number of seeks (number of IOs
239 submitted to lower level drivers), the \emph{mean} distance between
240 IOs, the \emph{median} value for all seeks, and the \emph{mode} -
241 the value(s) and the counts are provided for the latter.
243 The first of the two sections displays values for Q2Q seek distances --
244 providing a set of indicators showing how close incoming IO requests
245 are to each other. The second section shows D2D seek distances --
246 providing a set of indicators showing how close the IO requests are
247 that are handled by underlying drivers.
250 DEV | NSEEKS MEAN MEDIAN | MODE
251 --------- | ------ ------- ------ | -------
252 ( 68, 64) | 18178 19611.3 0 | 0(17522)
255 We have almost exclusively seen median and mode values of 0, indicating
256 that seeks tend to have an equal amount of forward and backwards
257 seeks. The larger the count for the mode in comparison to the total
258 number of seeks is indicative as to how many IOs are coming out of
259 the block IO layer in adjacent sectors. (Obviously, the higher this
260 percentage, the better the underlying subsystems can handle them.)
262 \item[Request Queue Plug Information]
264 During normal operation, requests queues are \emph{plugged} and during
265 such times the IO request queue elements are not able to be processed
266 by underlying drivers. The next section shows how often the request
267 queue was in such a state.
270 DEV | # Plugs # Timer Us | % Time Q Plugged
271 --------- | ------- ---------- | ----------------
272 ( 68, 64) | 833( 0) | 0.356511895%
275 There are two major reasons why request queues are unplugged, and both
276 are represented in the above table.
279 \item Explicit unplug request from some subsystem in the kernel.
281 \item Timed unplugs, due to a request queue exceeding some temporal
282 limit for being plugged.
285 The total number of unplugs is equal to the number of plugs less the
286 ones due to timer unplugs.
288 \item[IOs per Unplug \& Unplugs-due-to-timeout]
290 In this subsection one can see the average number of IOs on the request
291 queue at the time of an unplug or unplug due to a timeout. The following
292 sample shows a sample of both unplug sections:
295 ==================== Plug Information ====================
297 DEV | # Plugs # Timer Us | % Time Q Plugged
298 ---------- | ---------- ---------- | ----------------
299 ( 8, 0) | 1171( 123) | 0.280946640%
300 ( 8, 32) | 4( 0) | 0.000325469%
301 ---------- | ---------- ---------- | ----------------
302 Overall | # Plugs # Timer Us | % Time Q Plugged
303 Average | 587( 61) | 0.140636055%
305 DEV | IOs/Unp IOs/Unp(to)
306 ---------- | ---------- ----------
309 ---------- | ---------- ----------
310 DEV | IOs/Unp IOs/Unp(to)
314 This table and the preceding one have to be considered together --
315 in the sample output in the immediately preceding table one can see
316 how the larger number of data values for device (8,0) dominates in
319 \item[Active Requests At Q Information]
321 An important consideration when analyzing block IO schedulers is to
322 know how many requests the scheduler has to work with. The metric
323 provided in this section details how many requests (on average) were
324 being held by the IO scheduler when an incoming IO request was being
325 handled. To determine this, \texttt{btt} keeps track of how many Q
326 requests came in, and subtracts requests that have been issued (D).
328 Here is a sample output of this sections:
331 ==================== Active Requests At Q Information ====================
334 ---------- | -------------
339 ---------- | -------------
340 Overall | Avgs Reqs @ Q
347 \subsection*{\label{sec:detailed-data}Detailed Data}
349 In addition to the default sections output, if one supplies the
350 \texttt{--all-data} or \texttt{-A} argument (see section~\ref{sec:o-A})
351 to \texttt{btt} further sections are output:
354 \item[Per Process] As traces are emitted, they are tagged with the
355 process ID of the currently running thread in the kernel. The process
356 names are also preserved, and mapped to the ID. For each of the parts
357 of the time line discussed above on page~\pageref{tl-defs}, a chart is
358 provided which breaks down the traces according to process ID (name).
360 One must be aware, however, that the process ID may not have anything
361 to do with the originating IO. For example, if an application is
362 doing buffered IO, then the actual submitted IOs will most likely
363 come from some page buffer management daemon thread (like pdflush,
364 or kjournald for example). Similarly, completion traces are rarely
365 (if ever?) going to be associated with the process which submitted
366 the IO in the first place.
368 Here is a sample portion of this type of chart, showing Q2Q times
373 ------------- ----------- ----------- ----------- -------
374 mkfs.ext3 0.000000778 0.000009074 1.797176188 1899371
375 mount 0.000000885 0.000672513 0.030638128 73
376 pdflush 0.000000790 0.000006752 0.247231307 179791
379 \item[Per Process Averages] The average columns from the above charts,
380 are also presented in their own chart.
382 \item[Per Device] Similar to the per-process display, \texttt{btt}
383 will also break down the various parts of an IOs time line based upon a
384 per-device criteria. Here's a portion of this area, displayed showing
385 the issued to complete times (D2C).
389 --------- ----------- ----------- ----------- ------
390 ( 65, 80) 0.000140488 0.001076906 0.149739869 169112
391 ( 65, 96) 0.000142762 0.001215221 0.173263182 155488
392 ( 65,112) 0.000145221 0.001254966 0.124929936 165726
393 ( 65,128) 0.000141896 0.001159596 0.775231052 169015
394 ( 65,144) 0.000140832 0.001290985 0.211384698 210661
395 ( 65,160) 0.000139915 0.001175554 0.073512063 133973
396 ( 65,176) 0.000141254 0.001104870 0.073231310 145764
397 ( 65,192) 0.000141453 0.001234460 0.167622507 140618
401 \item[Per Device Averages] The average columns from the above charts,
402 are also presented in their own chart.
404 \item[Q2D Histogram] A display of histogram buckets for the Q to D times
405 -- basically, from where an IO enters the block IO layer for a given
406 device, and when it is dispatched. The buckets are arranged via the
407 time in seconds, as in:
410 ==================== Q2D Histogram ====================
412 DEV | <.005 <.010 <.025 <.050 <.075 <.100 <.250 <.500 < 1.0 >=1.0
413 --------- | ===== ===== ===== ===== ===== ===== ===== ===== ===== =====
414 ( 66, 80) | 61.2 7.9 12.1 7.9 3.0 1.4 1.5 0.2 0.0 4.6
415 ( 65,192) | 42.3 5.0 8.7 30.0 8.9 3.0 1.8 0.1 0.0 0.1
416 ( 65,128) | 34.3 5.3 8.9 32.0 9.7 3.7 5.3 0.6 0.0 0.1
418 ( 65, 64) | 59.9 4.2 6.0 24.6 4.2 0.8 0.1 0.0 0.0 0.1
419 ( 66, 64) | 62.6 8.1 12.7 7.9 2.4 0.6 0.1 0.0 0.0 5.4
420 ========== | ===== ===== ===== ===== ===== ===== ===== ===== ===== =====
421 AVG | 52.9 6.2 10.0 20.1 5.3 1.7 1.4 0.2 0.0 2.1
426 \newpage\section{\label{sec:data-files}Data Files Output}
428 Besides the averages output by default, the following 3 files are also
429 created with data points which may be plotted.
432 \item[\emph{file}.dat] This file provides a notion of \emph{activity}
433 for the system, devices and processes. The details of this file are
434 provided in section~\ref{sec:activity}.
436 \item[\emph{file}\_qhist.dat] Provides histogram data for the size of
437 incoming IO requests, for more information see section~\ref{sec:qhist}.
439 \item[\emph{file}\_dhist.dat] Provides histogram data for the size
440 of IO requests submitted to lower layer drivers, for more information
441 see section~\ref{sec:dhist}.
445 In addition to the default data files output, there are optional data
446 files which can be generated by btt. These include:
449 \item[subset of \texttt{.avg} data, easily parsed ] When the
450 \texttt{-X} option is specified \emph{and} the \texttt{-o} has also
451 been specified, then a subset of the data produced by default is
452 copied to another file that is \emph{more easily parsed.} Refer to
453 section~\ref{sec:o-X} for full details.
455 \item[iostat] iostat-like data can be distilled by btt, and is
456 described in section~\ref{sec:iostat}.
458 \item[per IO detail] Each and every IO traced can be output in a form
459 that shows each of the IO components on consecutive lines (rather
460 than grepping through a blkparse output file for example). The
461 details on this file is included in section~\ref{sec:per-io}.
463 \item[iostat] Latency information -- both Q2C and D2C --
464 on a per-IO basis can be generated. These are described in
465 sections~\ref{sec:lat-q2c} and~\ref{sec:lat-d2c}.
467 \item[seek details] A set of data files containing all IO-to-IO
468 sector differences can be output, with details found in
469 section~\ref{sec:seek}.
471 \item[unplug histogram details] A data file per device containing
472 histogram output for the amount of IOs released at unplug time.
473 Section~\ref{sec:o-u} has more details.
476 \newpage\section{\label{sec:activity}Activity Data File}
478 The activity data file contains a series of data values that indicate
479 those periods of time when queue and complete traces are being
480 processed. The values happen to be in a format easily handled by
481 xmgrace\footnote{\texttt{http://plasma-gate.weizmann.ac.il/Grace/}
482 ``Grace is a WYSIWYG 2D plotting tool for the X Window System and
483 M*tif.''}, but is easy to parse for other plotting and/or analysis
486 The file is split into pairs of sets of data points, where each pair
487 contains a set of queue activity and a set of completion activity. The
488 points are presented with the first column (X values) being the time
489 (in seconds), and the second column (Y values) providing an on/off
490 type of setting. For each pair, the Y values have two settings off
491 (low) and on (high). For example, here is a snippet of a file showing
496 # Total System : q activity
519 What this indicates is that there was q activity for the system
520 from 0.000000000 through 0.000070381, but was inactive from there to
521 1.023482637, and so on. Section~\ref{sec:o-d} contains details on how
522 to adjust btt's notion of what constitutes activity.
524 The pairs are arranged as follows:
527 \item First there is the total system activity -- meaning activity
528 in either queue or completion traces across all devices.
530 \item Next comes per-device activity information -- for each device
531 being traced, that request queues Q and C traces are presented.
533 \item Last we present pairs per-process.
536 Using this, one is then able to plot regions of activity versus
537 inactivity -- and one can gather a sense of deltas between the queueing
538 of IOs and when they are completed. Figure~\ref{fig:activity} shows
539 a very simplistic chart showing some activity:
542 \leavevmode\centering
543 \epsfig{file=activity.eps,width=4.5in}
544 \caption{\label{fig:activity}Simple Activity Chart}
547 When the black line (system Q activity) is \emph{high}, then the system
548 is seeing relatively continuous incoming queues. Conversely, when it is
549 low, it represents an extended period of time where no queue requests
550 were coming in. Similarly for the red line and C activity.
552 \newpage\section{\label{sec:hist}Histogram Data Files}
554 The histogram data files provide information concerning incoming and
555 outgoing IO sizes (in blocks). For simplicity, the histogram buckets
556 are one-for-one for sizes up to 1,024 blocks in the IO, and then a
557 single bucket for all sizes greater than or equal to 1,024 blocks.
559 The files are again in grace-friendly format, with the first set
560 containing data for the first 1,023 buckets, and a separate set
561 representing sizes $\ge 1024$ blocks. (This is done so that one can
562 easily use a separate formatting specification for the latter set.)
564 The first column (X values) is the various IO sizes, and the second
565 column (Y values) represents the number of IOs of that size.
567 \subsection*{\label{sec:qhist}Q Histogram Data File}
569 Figure~\ref{fig:qhist} is a sample graph generated from data used during
570 some real-world analysis\footnote{Note the logarithmic nature of the
571 Y axis for this chart.}. With the visual representation provided by
572 this, one can quickly discern some different characteristics between
573 the 3 runs -- in particular, one can see that there is only a single
574 red point (representing 8 blocks per IO), whereas the other two had
575 multiple data points greater than 8 blocks.
578 \leavevmode\centering
579 \epsfig{file=qhist.eps,width=4.5in}
580 \caption{\label{fig:qhist}Q Histogram}
583 \subsection*{\label{sec:dhist}D Histogram Data File}
585 Figure~\ref{fig:dhist} is a sample graph generated from data used during
586 some real-world analysis\footnote{Note the logarithmic nature of the
587 Y axis for this chart.}. Again, visually, one can see that the black
588 and blue dots are somewhat similar below about 192 blocks per IO going
589 out. And then one can make the broad generalization of higher reds,
590 lower blues and blacks in the middle.
593 \leavevmode\centering
594 \epsfig{file=dhist.eps,width=4.5in}
595 \caption{\label{fig:dhist}D Histogram}
598 \newpage\section{\label{sec:iostat}iostat Data File}
599 \texttt{btt} attempts to produce the results from running an
600 \texttt{iostat -x} command in parallel with the system as it is being
601 traced. The fields (columns) generated by the \texttt{--iostat} or
602 \texttt{-I} option can be seen from the following output snippet --
603 note that the line has been split to fit on the printed page:
606 Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s
607 rkB/s wkB/s avgrq-sz avgqu-sz await svctm %util Stamp
609 ( 8, 16) 0.00 0.00 0.00 1005.30 0.00 152806.36
610 0.00 76403.18 152.00 31.00 0.00 0.00 0.00 71.79
612 ( 8, 16) 1.02 5.80 0.34 1.07 4.03 55.62
613 2.02 27.81 42.13 0.61 0.00 21.90 0.00 TOTAL
616 Note that the STAMP field contains the runtime (in seconds) for that
619 \newpage\section{\label{sec:per-io}Per-IO Data File}
621 \texttt{btt} can produce a text file containing time line data for each
622 IO processed. The time line data contains rudimentary information for
623 the following stages:
627 \item get request traces
631 \item completion traces
635 The \emph{--per-io-dump} or \emph{-p} option triggers this behavior,
636 and will produce a file containing streams of IOs (separated by blank
637 spaces). As an example, here is a snippet of 4 IOs that were merged
638 together, you will note there are 3 merged IOs, and 1 inserted in the
639 stream. The issue and completion traces are replicated per IO.
642 66,0 : 0.763283556 Q 6208+8
645 0.763338848 D 6208+32
646 0.763705760 C 6208+32
648 66,0 : 0.763314550 Q 6224+8
650 0.763338848 D 6208+32
651 0.763705760 C 6208+32
653 66,0 : 0.763321010 Q 6232+8
655 0.763338848 D 6208+32
656 0.763705760 C 6208+32
658 65,240: 0.763244173 Q 6216+8
660 0.763374288 D 6208+32
661 0.763826610 C 6208+32
664 The columns provide the following information:
667 \item Device major/minor.
669 \item Time of the trace (seconds from the start of the run)
673 \item start block + number of blocks
676 \newpage\section{\label{sec:lat}\label{sec:lat-q2c}\label{sec:lat-d2c}Latency Data Files}
678 The latency data files which can be optionally produced by \texttt{btt}
679 provide per-IO latency information, one for total IO time (Q2C) and
680 one for latencies induced by lower layer drivers and devices (D2C).
682 In both cases, the first column (X values) represent runtime (seconds),
683 while the second column (Y values) shows the actual latency for a
684 command at that time (either Q2C or D2C).
686 \newpage\section{\label{sec:seek}Seek Data Files}
688 \texttt{btt} can also produce two data files containing all IO-to-IO sector
689 deltas, providing seek information which can then be plotted. The
690 produced data file contains 3 sets of data:
693 \item Combined data -- all read and write IOs
695 \item Read data -- just seek deltas for reads
697 \item Write data -- just seek deltas for writes
700 The format of the output file names is to have the name generated by
701 the following fields separated by underscores (\texttt{\_}):
704 \item The prefix provided as the argument to the \texttt{-s} option.
705 \item The major and minor numbers of the device separated by a comma.
706 \item The string \texttt{q2q} or \texttt{d2d}, indicating the Q2Q or
707 D2D seeks, respectively.
708 \item One of the following characters:
710 \item[r] For read (device to system) IOs
711 \item[w] For write (system to device) IOs
712 \item[c] Combined -- both read and write IOs
716 An example name would be after specifying \texttt{-s seek} would be:
717 \texttt{seek\_065,048\_q2q\_w.dat}.
719 The format of the data is to have the runtime values (seconds since
720 the start of the run) in column 1 (X values); and the difference in
721 sectors from the previous IO in column 2 (Y values). Here is a snippet
722 of the first few items from a file:
726 0.000034733 35283790.0
727 0.000106453 35283790.0
728 0.005239009 35283950.0
729 0.006968575 35283886.0
730 0.007218709 35283694.0
731 0.012145393 35283566.0
732 0.014980835 -35848914.0
733 0.024239323 -35848914.0
734 0.024249402 -35848914.0
735 0.025707095 -35849072.0
739 Figure~\ref{fig:seek} shows a simple graph that can be produced which
740 provides visual details concerning seek patterns.
743 \leavevmode\centering
744 \epsfig{file=seek.eps,width=4.5in}
745 \caption{\label{fig:seek}Seek Chart}
749 The seek difference is calculated in one of two ways:
752 \item[default] By default, the seek distance is calculated as the
753 \emph{closest} distance between the previous IO and this IO. The
754 concept of \emph{closeness} means that it could either be the
755 \emph{end} of the previous IO and the beginning of the next, or the
756 end of this IO and the start of the next.
758 \item[\texttt{-a}] If the \texttt{-a} or \texttt{--seek-absolute}
759 option is specified, then the seek distance is simply the difference
760 between the end of the previous IO and the start of this IO.
763 \newpage\subsection{\label{sec:sps-spec}Seeks Per Second}
765 When the \texttt{-m} option provides a name, Q2Q and/or D2D seeks
766 will trigger \texttt{btt} to output seeks-per-second information. The
767 first column will contain a time value (seconds), and the second column
768 will indicate the number of seeks per second at that point.
770 When there is only a single data point within a 1-second window,
771 \texttt{btt} will just output the time value for the point, and the
772 value 1.0 in the second column.
774 Otherwise, if $\alpha$ and $\Omega$ are the first and last times
775 seen within a 1-second window, and $\nu$ are the number of seeks seen
776 in that time frame, then:
779 \item[column 1] Midway point in time for this span, or: \hfill$\alpha +
780 {{(\Omega - \alpha)} / 2}$
782 \item[column 2] Average seeks per second over this span, or: \hfill$\nu /
786 Figure~\ref{fig:sps} shows a simple pair of graphs generated from
790 \leavevmode\centering
791 \epsfig{file=sps.eps,width=4.5in}
792 \caption{\label{fig:sps}Seeks-per-second Chart}
796 \newpage\section{\label{sec:cmd-line}Command Line}
800 [ -a | --seek-absolute ]
802 [ -B <output name> | --dump-blocknos=<output name> ]
803 [ -d <seconds> | --range-delta=<seconds> ]
804 [ -D <dev;...> | --devices=<dev;...> ]
805 [ -e <exe,...> | --exes=<exe,...> ]
807 [ -i <input name> | --input-file=<input name> ]
808 [ -I <output name> | --iostat=<output name> ]
809 [ -l <output name> | --d2c-latencies=<output name> ]
810 [ -m <output name> | --seeks-per-second=<output name> ]
811 [ -M <dev map> | --dev-maps=<dev map>
812 [ -o <output name> | --output-file=<output name> ]
813 [ -p <output name> | --per-io-dump=<output name> ]
814 [ -q <output name> | --q2c-latencies=<output name> ]
815 [ -s <output name> | --seeks=<output name> ]
816 [ -S <interval> | --iostat-interval=<interval> ]
817 [ -t <sec> | --time-start=<sec> ]
818 [ -T <sec> | --time-end=<sec> ]
819 [ -u <output name> | --unplug-hist=<output name> ]
822 [ -X | --easy-parse-avgs ]
825 \subsection{\label{sec:o-a}\texttt{--seek-absolute}/\texttt{-a}}
827 When specified on the command line, this directs btt to calculate
828 seek distances based solely upon the ending block address of one IO,
829 and the start of the next. By default \texttt{btt} uses the concept
830 of the closeness to either the beginning or end of the previous IO. See
831 section~\ref{sec:seek} for more details about seek distances.
833 \subsection{\label{sec:o-A}\texttt{--all-data}/\texttt{-A}}
835 Normally \texttt{btt} will not print out verbose information
836 concerning per-process and per-device data (as outlined in
837 section~\ref{sec:detailed-data}). If you desire that level of
838 detail you can specify this option.
840 \subsection{\label{sec:o-B}\texttt{--dump-blocknos}/\texttt{-B}}
842 This option will output absolute block numbers to three files prefixed
843 by the specified output name:
846 \item[\emph{prefix}\_\emph{device}\_r.dat] All read block numbers are
847 output, first column is time (seconds), second is the block number,
848 and the third column is the ending block number.
850 \item[\emph{prefix}\_\emph{device}\_w.dat] All write block numbers are
851 output, first column is time (seconds), second is the block number,
852 and the third column is the ending block number.
854 \item[\emph{prefix}\_\emph{device}\_c.dat] All block numbers (read
855 and write) are output, first column is time (seconds), second is
856 the block number, and the third column is the ending block number.
859 \subsection{\label{sec:o-d}\texttt{--range-delta}/\texttt{-d}}
861 Section~\ref{sec:activity} discussed how \texttt{btt} outputs a file
862 containing Q and C activity, the notion of \emph{active} traces simply
863 means that there are Q or C traces occurring within a certain period
864 of each other. The default values is 0.1 seconds; with this option
865 allowing one to change that granularity. The smaller the value, the
866 more data points provided.
868 \subsection{\label{sec:o-D}\texttt{--devices}/\texttt{-D}}
870 Normally, \texttt{btt} will produce data for all devices detected in
871 the traces parsed. With this option, one can reduce the analysis to
872 one or more devices provided in the string passed to this option. The
873 device identifiers are the major and minor number of each device, and
874 each device identifier is separated by a colon (:). A valid specifier
875 for devices 8,0 and 8,8 would then be: \texttt{"8,0:8,8"}.
877 \subsection{\label{sec:o-e}\texttt{--exes}/\texttt{-e}}
879 Likewise, \texttt{btt} will produce data for all processes (executables)
880 found in the traces. With this option, one can specify which processes
881 you want displayed in the output. The format of the string passed is
882 a list of executable \emph{names} separated by commas (,). An example
883 would be \texttt{"-e mkfs.ext3,mount"}.
885 \subsection{\label{sec:o-h}\texttt{--help}/\texttt{-h}}
887 Prints out the simple help information, as seen at the top of
888 section~\ref{sec:cmd-line}.
890 \subsection{\label{sec:o-i}\texttt{--input-file}/\texttt{-i}}
892 Specifies the binary input file that \texttt{btt} will interpret traces
893 in. See section~\ref{sec:getting-started} for information concerning
896 \subsection{\label{sec:o-I}\texttt{--iostat}/\texttt{-I}}
898 This option triggers \texttt{btt} to generate iostat-like output to the
899 file specified. Refer to section~\ref{sec:iostat} for more information
900 on the output produced.
902 \subsection{\label{sec:o-l}\texttt{--d2c-latencies}/\texttt{-l}}
904 This option instructs \texttt{btt} to generate the D2C latency file
905 discussed in section~\ref{sec:lat-d2c}.
907 \subsection{\label{sec:o-m}\texttt{--seeks-per-second}\texttt{-m}}
909 Tells \texttt{btt} to output seeks per second information. Each device
910 being measured can have up to 2 files output: One with Q2Q information
911 and one with D2D seek information. Information on the output produced
912 can be found in section~\ref{sec:sps-spec}.
915 \textbf{Note: This requires seek output to be selected -- see
916 section~\ref{sec:seek}.}
919 \subsection{\label{sec:o-M}\texttt{--dev-maps}/\texttt{-M}}
921 Internal option, still under construction.
923 \subsection{\label{sec:o-o}\texttt{--output-file}/\texttt{-o}}
925 Normally \texttt{btt} sends the statistical output (covered in
926 section~\ref{sec:output-overview}) to standard out, if you specify
927 this option this data is redirected to the file specified.
929 \subsection{\label{sec:o-p}\texttt{--per-io-dump}/\texttt{-p}}
931 This option tells \texttt{btt} to generate the per IO dump file as
932 discussed in section~\ref{sec:per-io}.
934 \subsection{\label{sec:o-q}\texttt{--q2c-latencies}/\texttt{-q}}
936 This option instructs \texttt{btt} to generate the Q2C latency file
937 discussed in section~\ref{sec:lat-q2c}.
939 \subsection{\label{sec:o-s}\texttt{--seeks}/\texttt{-s}}
941 This option instructs \texttt{btt} to generate the seek data file
942 discussed in section~\ref{sec:seek}.
944 \subsection{\label{sec:o-S}\texttt{--iostat-interval}/\texttt{-S}}
946 The normal \texttt{iostat} command allows one to specify the snapshot
947 interval, likewise, \texttt{btt} allows one to specify how many seconds
948 between its generation of snapshots of the data via this option. Details
949 about the iostat-like capabilities of \texttt{btt} may be found in
950 section~\ref{sec:iostat}.
952 \subsection{\label{sec:o-tT}\texttt{--time-start}/\texttt{-t} and
953 \texttt{--time-end}/\texttt{T}}
956 \emph{This \texttt{btt} capability is still under construction, results are
957 not always consistent at this point in time.}
960 These options allow one to dictate to \texttt{btt} when to start and stop
961 parsing of trace data in terms of seconds since the start of the run. The
962 trace chosen will be between the start time (or 0.0 if not
963 specified) and end time (or the end of the run) specified.
965 \subsection{\label{sec:o-u}\texttt{--unplug-hist}/\texttt{-u}}
967 This option instructs \texttt{btt} to generate a data file containing
968 histogram information for \emph{unplug} traces on a per device
969 basis. It shows how many times an unplug was hit with a specified
970 number of IOs released. There are 21 output values into the file, as
975 \textbf{X value} & \textbf{Representing Counts} \\\hline
985 The file name(s) generated use the text string passed as an argument for
986 the prefix, followed by the device identifier in \texttt{major,minor}
987 form, with a \texttt{.dat} extension (as an example, with \texttt{-u
988 up\_hist} specified on the command line: \texttt{up\_hist\_008,032.dat}.
990 \subsection{\label{sec:o-V}\texttt{--version}/\texttt{-V}}
992 Prints out the \texttt{btt} version, and exits.
994 \subsection{\label{sec:o-v}\texttt{--verbose}/\texttt{-v}}
996 While \texttt{btt} is processing data, it will put out periodic (1-second
997 granularity) values describing the progress it is making through the
998 input trace stream. The value describes how many traces have been
999 processed. At the end of the run, the overall number of traces, trace
1000 rate (number of thousands of traces per second), and the real time for
1001 trace processing and output are displayed. Example (note: the interim
1002 trace counts are put out with carriage returns, hence, they overwrite
1006 # btt -i bp.bin -o btt -v
1007 Sending range data to bttX.dat
1008 Sending stats data to bttX.avg
1013 4581291 traces @ 279.7 Ktps
1014 16.379036+0.000005=16.379041
1017 \subsection{\label{sec:o-X}\texttt{--easy-parse-avgs}/\texttt{-X}}
1019 \emph{Some} of the data produced by default can also be shipped
1020 simultaneously to another file in an easy to parse form. When
1021 the \texttt{-o} option is selected (thus producing a file with a
1022 \texttt{.avg} exentsion), \emph{and} the \texttt{-X} flag is present,
1023 then \texttt{btt} will generate this file.
1025 The format is space-delimited values starting with a 3-character
1026 \emph{record} indicator, then the device information (either major,minor
1027 or the device name when \texttt{-M} is specified), and then a number of
1028 fields representing data values. The following table shows the record
1029 identifiers and the fields provided:
1032 \begin{tabular}{|l|l|}\hline
1033 \textbf{Record} & \textbf{Description}\\\hline
1034 \texttt{DMI} & Device Merge Information:\\
1035 & \#Q \#D Ratio BLKmin BLKavg BLKmax Total\\\hline
1036 \texttt{QSK} & Device Q2Q Seek Information:\\
1037 & NSEEKS MEAN MEDIAN MODE N-MODE mode\ldots\\\hline
1038 \texttt{DSK} & Device D2D Seek Information:\\
1039 & NSEEKS MEAN MEDIAN MODE N-MODE mode\ldots\\\hline
1040 \texttt{PLG} & Plug Information:\\
1041 & \#Plugs \#TimerUnplugs \%TimeQPlugged\\\hline
1042 \texttt{UPG} & Unplug Information:\\
1043 & IOsPerUnplug IOsPerUnplugTimeout\\\hline
1044 \texttt{ARQ} & Active Requests at Q Information:\\
1045 & AvgReqs@Q\\\hline\hline
1046 \texttt{Q2Q} & Queue-to-Queue times:\\
1047 \texttt{Q2G} & Queue-to-GetRequest times:\\
1048 \texttt{S2G} & Sleep-to-GetRequest times:\\
1049 \texttt{G2I} & GetRequest-to-Insert times:\\
1050 \texttt{Q2M} & Queue-to-Merge times:\\
1051 \texttt{I2D} & Insert-to-Issue times:\\
1052 \texttt{M2D} & Merge-to-Issue times:\\
1053 \texttt{D2C} & Issue-to-Complete times:\\
1054 \texttt{Q2C} & Queue-to-Complete times:\\
1055 & MIN AVG MAX N\\\hline
1059 A sample output file would look like:
1062 Q2Q 0.000000001 0.003511356 9.700000000 309906
1063 Q2G 0.000000001 0.774586535 805.300000000 106732
1064 S2G 0.000000001 0.072525952 0.370000000 578
1065 G2I 0.000000001 0.000001125 0.010000000 106732
1066 Q2M 0.000000001 0.730763626 751.820000000 204040
1067 I2D 0.000000001 1.270720538 612.880000000 106948
1068 M2D 0.000000001 0.992355230 428.930000000 203114
1069 D2C 0.000000001 0.008681311 137.020000000 307343
1070 Q2C 0.000000001 1.304370794 805.660000000 308921
1071 DMI 8,16 309907 106729 2.903681286 8 182 1024 19504768
1072 QSK 8,16 309907 167200.935561314 0 0 235708
1073 DSK 8,16 106729 433247.436563633 0 0 33974
1074 PLG 8,16 40824 382 0.008881420
1075 UPG 8,16 1.993361748 1.866492147
1076 ARQ 8,16 12.938165321
1079 \newpage\section{\label{sec:bno_plot}bno\_plot.py}
1081 Included with the distribution is a simple 3D plotting utility based
1082 upon the block numbers output when \texttt{-B} is specified (see
1083 section~\ref{sec:o-B} for more details about the \texttt{-B option}). The
1084 display will display \emph{each} IO generated, with the time (seconds)
1085 along the X-axis, the block number (start) along the Y-axis and the
1086 number of blocks transferred in the IO represented along the Z-axis.
1088 The script requires Python\footnote{\texttt{www.python.org}} and
1089 gnuplot\footnote{\texttt{www.gnuplot.info}}, and will enter interactive
1090 mode after the image is produced. In this interactive mode one can enter
1091 gnuplot commands at the \texttt{'gnuplot>'} prompt, and/or can change
1092 the viewpoint within the 3D image by \emph{left-click-hold} and moving
1093 the mouse. A sample screen shot can be seen in figure~\ref{fig:bno_plot} on
1094 page~\pageref{fig:bno_plot}.
1096 \subsection*{\texttt{bno\_plot.py} Command Line Options}
1101 $ bno_plot.py --help
1105 [ -K | --keys-below ]
1109 Utilizes gnuplot to generate a 3D plot of the block number
1110 output from btt. If no <files> are specified, it will
1111 utilize all files generated after btt was run with -B
1112 blknos (meaning: all files of the form blknos*[rw].dat).
1114 The -K option forces bno_plot.py to put the keys below the
1115 graph, typically all keys for input files are put in the
1116 upper right corner of the graph. If the number of devices
1117 exceed 10, then bno_plot.py will automatically push the
1118 keys under the graph.
1120 To exit the plotter, enter 'quit' or ^D at the 'gnuplot> '
1126 \leavevmode\centering
1127 \epsfig{file=bno_plot.eps,width=5.5in}
1128 \caption{\label{fig:bno_plot}Sample \texttt{bno\_plot.py} Screen Shot}
1132 \newpage\section{\label{sec:appendix}Sample \texttt{btt}
1134 Here is a complete output file from a btt run, illustrating a lot of the
1135 capabilities of btt.
1136 \input{sample-btt-output.tex}
1139 \subsection{\label{sec:o-B}\texttt{--dump-blocknos}/\texttt{-B}}