fio: allow to combine terse output with any selected output type
authorChristian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
Thu, 20 Feb 2014 13:20:04 +0000 (14:20 +0100)
committerJens Axboe <axboe@fb.com>
Thu, 20 Feb 2014 17:14:05 +0000 (09:14 -0800)
This patch adds the option --append-terse to be able to request a
combination of any given selected output format AND terse output based
on the same data.

This will help all users that want to parse the terse data for further
use, but need to look into the logs every now and then which then should
be readable.

Signed-off-by: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
fio.1
fio.h
init.c
stat.c

diff --git a/fio.1 b/fio.1
index 1f3f4dd6b39af7241827fba2a918977af5ae2560..4377052ff61ae88224f4668304c7f8a6de4874b6 100644 (file)
--- a/fio.1
+++ b/fio.1
@@ -32,6 +32,9 @@ Generate per-job bandwidth logs.
 .B \-\-minimal
 Print statistics in a terse, semicolon-delimited format.
 .TP
+.B \-\-append-terse
+Print statistics in selected mode AND terse, semicolon-delimited format.
+.TP
 .B \-\-version
 Display version information and exit.
 .TP
@@ -1578,9 +1581,10 @@ It is also possible to get fio to dump the current output while it is
 running, without terminating the job. To do that, send fio the \fBUSR1\fR
 signal.
 .SH TERSE OUTPUT
-If the \fB\-\-minimal\fR option is given, the results will be printed in a
-semicolon-delimited format suitable for scripted use - a job description
-(if provided) follows on a new line.  Note that the first
+If the \fB\-\-minimal\fR / \fB\-\-append-terse\fR options are given, the
+results will be printed/appended in a semicolon-delimited format suitable for
+scripted use.
+A job description (if provided) follows on a new line.  Note that the first
 number in the line is the version number. If the output has to be changed
 for some reason, this number will be incremented by 1 to signify that
 change.  The fields are:
diff --git a/fio.h b/fio.h
index 75ed804b0d3ee850f1ff37865e00df17032db2d2..d1180cd4809bb090e5a96e4266be0da5933c80e5 100644 (file)
--- a/fio.h
+++ b/fio.h
@@ -373,6 +373,7 @@ extern unsigned int stat_number;
 extern int shm_id;
 extern int groupid;
 extern int output_format;
+extern int append_terse_output;
 extern int temp_stall_ts;
 extern uintptr_t page_mask, page_size;
 extern int read_only;
diff --git a/init.c b/init.c
index 7f8b3178ebd26f36e47c434dbcf035a6b8ceac28..5fc3b224f2d4c766a8a8cd07574fe24120cd173d 100644 (file)
--- a/init.c
+++ b/init.c
@@ -43,6 +43,7 @@ struct thread_data *threads = NULL;
 
 int exitall_on_terminate = 0;
 int output_format = FIO_OUTPUT_NORMAL;
+int append_terse_output = 0;
 int eta_print = FIO_ETA_AUTO;
 int eta_new_line = 0;
 FILE *f_out = NULL;
@@ -108,6 +109,11 @@ static struct option l_opts[FIO_NR_OPTIONS] = {
                .has_arg        = optional_argument,
                .val            = 'F' | FIO_CLIENT_FLAG,
        },
+       {
+               .name           = (char *) "append-terse",
+               .has_arg        = optional_argument,
+               .val            = 'f',
+       },
        {
                .name           = (char *) "version",
                .has_arg        = no_argument,
@@ -1716,6 +1722,9 @@ int parse_cmd_line(int argc, char *argv[], int client_type)
                        else
                                output_format = FIO_OUTPUT_NORMAL;
                        break;
+               case 'f':
+                       append_terse_output = 1;
+                       break;
                case 'h':
                        if (!cur_client) {
                                usage(argv[0]);
diff --git a/stat.c b/stat.c
index 5d50ae865a1268865b1831a5147eff1ff00acd59..77275d94efe4de77f3fb3bc6a39fa6b70121c07a 100644 (file)
--- a/stat.c
+++ b/stat.c
@@ -1386,6 +1386,16 @@ static void __show_run_stats(void)
                show_idle_prof_stats(FIO_OUTPUT_NORMAL, NULL);
        }
 
+       if ( !(output_format == FIO_OUTPUT_TERSE) && append_terse_output) {
+               log_info("\nAdditional Terse Output:\n");
+
+               for (i = 0; i < nr_ts; i++) {
+                       ts = &threadstats[i];
+                       rs = &runstats[ts->groupid];
+                       show_thread_status_terse(ts, rs);
+               }
+       }
+
        log_info_flush();
        free(runstats);
        free(threadstats);