From 50f7389936188591eda0f114ab682520e6fe90c9 Mon Sep 17 00:00:00 2001 From: "Alan D. Brunelle" Date: Tue, 13 Nov 2007 17:16:38 -0500 Subject: [PATCH] Added active requests at Q information. An important consideration when analyzing block IO schedulers is to know how many requests the scheduler has to work with. The metric provided in this section details how many requests (on average) were being held by the IO scheduler when an incoming IO request was being handled. To determine this, btt keeps track of how many Q requests came in, and subtacts requests that have been issued (D). Sample: ==================== Active Requests At Q Information ==================== DEV | Avg Reqs @ Q ---------- | ------------- ( 65, 80) | 12.0 ( 65,240) | 16.9 ( 65,112) | 13.3 ( 66, 64) | 32.8 ( 66, 80) | 21.5 ( 65, 96) | 8.6 ( 66, 16) | 16.2 ( 65, 64) | 20.4 ( 66, 96) | 18.3 ( 65,176) | 17.4 ( 66, 32) | 13.6 ( 65,144) | 13.4 ( 66, 0) | 21.4 ( 65,192) | 19.4 ( 66,128) | 18.4 ( 66,144) | 16.2 ( 65,128) | 8.0 ( 66,112) | 44.2 ---------- | ------------- Overall | Avgs Reqs @ Q Average | 17.4 Signed-off-by: Alan D. Brunelle --- btt/doc/btt.tex | 32 +++++++++++++++++++++++++++++--- btt/globals.h | 1 + btt/output.c | 42 ++++++++++++++++++++++++++++++++++++++++++ btt/trace_issue.c | 3 +++ btt/trace_queue.c | 3 +++ 5 files changed, 78 insertions(+), 3 deletions(-) diff --git a/btt/doc/btt.tex b/btt/doc/btt.tex index c795cb9..f35cf1f 100644 --- a/btt/doc/btt.tex +++ b/btt/doc/btt.tex @@ -22,7 +22,7 @@ \title{\texttt{btt} User Guide} \author{Alan D. Brunelle (Alan.Brunelle@hp.com)} -\date{16 April 2007} +\date{13 November 2007} \begin{document} \maketitle @@ -56,7 +56,7 @@ easier. \bigskip This document refers to the output formats generated by \texttt{btt} - version 0.99.1. However, the descriptions are general enough to cover + version 2.00. However, the descriptions are general enough to cover output formats prior to that. \newpage\tableofcontents @@ -251,6 +251,32 @@ Q2C 0.000207665 0.125405263 1.830917198 2262311 The total number of unplugs is equal to the number of plugs less the ones due to timer unplugs. + + \item[Active Requests At Q Information] + + An important consideration when analyzing block IO schedulers is to + know how many requests the scheduler has to work with. The metric + provided in this section details how many requests (on average) were + being held by the IO scheduler when an incoming IO request was being + handled. To determine this, \texttt{btt} keeps track of how many Q + requests came in, and subtacts requests that have been issued (D). + + Here is a sample output of this sections: + +\begin{verbatim} +==================== Active Requests At Q Information ==================== + + DEV | Avg Reqs @ Q +---------- | ------------- + ( 65, 80) | 12.0 + ( 65,240) | 16.9 +... + ( 66,112) | 44.2 +---------- | ------------- + Overall | Avgs Reqs @ Q + Average | 17.4 +\end{verbatim} + \end{description} \newpage @@ -646,7 +672,7 @@ Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s \newpage\section{\label{sec:cmd-line}Command Line} \begin{verbatim} -Usage: \texttt{btt} 0.99.1 +Usage: btt 2.00 [ -a | --seek-absolute ] [ -A | --all-data ] [ -B | --dump-blocknos= ] diff --git a/btt/globals.h b/btt/globals.h index e1751e4..5a6db04 100644 --- a/btt/globals.h +++ b/btt/globals.h @@ -163,6 +163,7 @@ struct d_info { struct avgs_info avgs; struct stats stats, all_stats; __u64 last_q, n_qs, n_ds; + __u64 n_act_q, t_act_q; /* # currently active when Q comes in */ __u32 device; int pre_culling; diff --git a/btt/output.c b/btt/output.c index 21392d6..ebfd3d8 100644 --- a/btt/output.c +++ b/btt/output.c @@ -510,6 +510,45 @@ void output_plug_info(FILE *ofp) fprintf(ofp, "\n"); } +int n_actQs; +struct actQ_info { + __u64 t_qs; + __u64 t_act_qs; +} actQ_info; + +void __dip_output_actQ(struct d_info *dip, void *arg) +{ + if (dip->n_qs > 0 && !remapper_dev(dip->device)) { + char dev_info[15]; + double a_actQs = (double)dip->t_act_q / (double)dip->n_qs; + + fprintf((FILE *)arg, "%10s | %13.1lf\n", + make_dev_hdr(dev_info, 15, dip), a_actQs); + + n_actQs++; + actQ_info.t_qs += dip->n_qs; + actQ_info.t_act_qs += dip->t_act_q; + } +} + +void __dip_output_actQ_all(FILE *ofp, struct actQ_info *p) +{ + fprintf(ofp, "---------- | -------------\n"); + fprintf(ofp, "%10s | %13s\n", "Overall", "Avgs Reqs @ Q"); + fprintf(ofp, "%10s | %13.1lf\n", "Average", + (double)p->t_act_qs / (double)p->t_qs); +} + +void output_actQ_info(FILE *ofp) +{ + fprintf(ofp, "%10s | %13s\n", "DEV", "Avg Reqs @ Q"); + fprintf(ofp, "---------- | -------------\n"); + dip_foreach_out(__dip_output_actQ, ofp); + if (n_actQs > 1) + __dip_output_actQ_all(ofp, &actQ_info); + fprintf(ofp, "\n"); +} + void output_histos(void) { int i; @@ -604,6 +643,9 @@ int output_avgs(FILE *ofp) output_section_hdr(ofp, "Plug Information"); output_plug_info(ofp); + output_section_hdr(ofp, "Active Requests At Q Information"); + output_actQ_info(ofp); + output_histos(); return 0; diff --git a/btt/trace_issue.c b/btt/trace_issue.c index 8b1571a..fd7ea49 100644 --- a/btt/trace_issue.c +++ b/btt/trace_issue.c @@ -25,6 +25,9 @@ static void handle_issue(struct io *d_iop) LIST_HEAD(head); struct list_head *p, *q; + if (d_iop->dip->n_act_q != 0) + d_iop->dip->n_act_q--; + seeki_add(d_iop->dip->seek_handle, d_iop); bno_dump_add(d_iop->dip->bno_dump_handle, d_iop); iostat_issue(d_iop); diff --git a/btt/trace_queue.c b/btt/trace_queue.c index 1d2afbe..fe85a09 100644 --- a/btt/trace_queue.c +++ b/btt/trace_queue.c @@ -33,6 +33,9 @@ static void handle_queue(struct io *q_iop) q_iop->i_time = q_iop->gm_time = q_iop->d_time = (__u64)-1; q_iop->is_getrq = -1; q_iop->dip->n_qs++; + + q_iop->dip->t_act_q += q_iop->dip->n_act_q; + q_iop->dip->n_act_q++; } void trace_queue(struct io *q_iop) -- 2.25.1