From:  Alan D. Brunelle <[EMAIL PROTECTED]>

BTT: Clean up output in preparation for first major documentation effort.

Took out non-useful verbose per-device and per-process data from
default output. Added in -A option to put that out.

Signed-off-by: Alan D. Brunelle <[EMAIL PROTECTED]>
---

 btt/args.c        |   11 ++++++++++-
 btt/bt_timeline.c |    2 +-
 btt/globals.h     |    2 +-
 btt/output.c      |   48 ++++++++++++++++++++++++++----------------------
 4 files changed, 38 insertions(+), 25 deletions(-)

diff --git a/btt/args.c b/btt/args.c
index e6df5e7..a7cf01e 100644
--- a/btt/args.c
+++ b/btt/args.c
@@ -27,9 +27,15 @@
 #include <fcntl.h>
 #include "globals.h"
 
-#define S_OPTS "d:D:e:hi:I:l:M:o:p:q:s:S:t:T:Vv"
+#define S_OPTS "Ad:D:e:hi:I:l:M:o:p:q:s:S:t:T:Vv"
 static struct option l_opts[] = {
        {
+               .name = "all-data",
+               .has_arg = no_argument,
+               .flag = NULL,
+               .val = 'A'
+       },
+       {
                .name = "range-delta",
                .has_arg = required_argument,
                .flag = NULL,
@@ -167,6 +173,9 @@ void handle_args(int argc, char *argv[])
 
        while ((c = getopt_long(argc, argv, S_OPTS, l_opts, NULL)) != -1) {
                switch (c) {
+               case 'A':
+                       output_all_data = 1;
+                       break;
                case 'd':
                        sscanf(optarg, "%lf", &range_delta);
                        break;
diff --git a/btt/bt_timeline.c b/btt/bt_timeline.c
index 0438e3f..ad7ce49 100644
--- a/btt/bt_timeline.c
+++ b/btt/bt_timeline.c
@@ -30,7 +30,7 @@ char bt_timeline_version[] = "0.99";
 char *devices, *exes, *input_name, *output_name, *seek_name;
 char *d2c_name, *q2c_name, *per_io_name;
 FILE *ranges_ofp, *avgs_ofp, *per_io_ofp;
-int verbose, done, time_bounded;
+int verbose, done, time_bounded, output_all_data;
 double t_astart, t_aend;
 unsigned long n_traces;
 struct avgs_info all_avgs;
diff --git a/btt/globals.h b/btt/globals.h
index cdf6fc9..b4e9894 100644
--- a/btt/globals.h
+++ b/btt/globals.h
@@ -195,7 +195,7 @@ 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 double range_delta;
 extern FILE *ranges_ofp, *avgs_ofp, *iostat_ofp, *per_io_ofp;;
-extern int verbose, done, time_bounded;
+extern int verbose, done, time_bounded, output_all_data;
 extern unsigned int n_devs;
 extern unsigned long n_traces;
 extern struct list_head all_devs, all_procs, retries;
diff --git a/btt/output.c b/btt/output.c
index 44e7bac..1c80dfe 100644
--- a/btt/output.c
+++ b/btt/output.c
@@ -523,23 +523,25 @@ void output_histos(void)
 
 int output_avgs(FILE *ofp)
 {
-       if (exes == NULL || *exes != '\0') {
-               output_section_hdr(ofp, "Per Process");
-               output_pip_avg(ofp, "Q2Q", pip_q2q_avg);
-               output_pip_avg(ofp, "Q2A", pip_q2a_avg);
-               output_pip_avg(ofp, "Q2I", pip_q2i_avg);
-               output_pip_avg(ofp, "I2D", pip_i2d_avg);
-               output_pip_avg(ofp, "D2C", pip_d2c_avg);
-               output_pip_avg(ofp, "Q2C", pip_q2c_avg);
-       }
+       if (output_all_data) {
+               if (exes == NULL || *exes != '\0') {
+                       output_section_hdr(ofp, "Per Process");
+                       output_pip_avg(ofp, "Q2Q", pip_q2q_avg);
+                       output_pip_avg(ofp, "Q2A", pip_q2a_avg);
+                       output_pip_avg(ofp, "Q2I", pip_q2i_avg);
+                       output_pip_avg(ofp, "I2D", pip_i2d_avg);
+                       output_pip_avg(ofp, "D2C", pip_d2c_avg);
+                       output_pip_avg(ofp, "Q2C", pip_q2c_avg);
+               }
 
-       output_section_hdr(ofp, "Per Device");
-       output_dip_avg(ofp, "Q2Q", dip_q2q_avg);
-       output_dip_avg(ofp, "Q2A", dip_q2a_avg);
-       output_dip_avg(ofp, "Q2I", dip_q2i_avg);
-       output_dip_avg(ofp, "I2D", dip_i2d_avg);
-       output_dip_avg(ofp, "D2C", dip_d2c_avg);
-       output_dip_avg(ofp, "Q2C", dip_q2c_avg);
+               output_section_hdr(ofp, "Per Device");
+               output_dip_avg(ofp, "Q2Q", dip_q2q_avg);
+               output_dip_avg(ofp, "Q2A", dip_q2a_avg);
+               output_dip_avg(ofp, "Q2I", dip_q2i_avg);
+               output_dip_avg(ofp, "I2D", dip_i2d_avg);
+               output_dip_avg(ofp, "D2C", dip_d2c_avg);
+               output_dip_avg(ofp, "Q2C", dip_q2c_avg);
+       }
 
        output_section_hdr(ofp, "All Devices");
        output_hdr(ofp, "ALL");
@@ -554,13 +556,15 @@ int output_avgs(FILE *ofp)
        output_section_hdr(ofp, "Device Overhead");
        output_dip_prep_ohead(ofp);
 
-       if (exes == NULL || *exes != '\0') {
-               output_section_hdr(ofp, "Per Process (avgs)");
-               output_pip_avgs(ofp);
-       }
+       if (output_all_data) {
+               if (exes == NULL || *exes != '\0') {
+                       output_section_hdr(ofp, "Per Process (avgs)");
+                       output_pip_avgs(ofp);
+               }
 
-       output_section_hdr(ofp, "Per Device (avgs)");
-       output_dip_avgs(ofp);
+               output_section_hdr(ofp, "Per Device (avgs)");
+               output_dip_avgs(ofp);
+       }
 
        output_section_hdr(ofp, "Device Merge Information");
        output_dip_merge_ratio(ofp);

Reply via email to