Add 'stats' option
authorJens Axboe <axboe@fb.com>
Thu, 16 Mar 2017 20:43:37 +0000 (14:43 -0600)
committerJens Axboe <axboe@fb.com>
Thu, 16 Mar 2017 20:43:37 +0000 (14:43 -0600)
This option controls whether or not we collect runtime stats
and show stat output for a given job. Defaults to on.

Signed-off-by: Jens Axboe <axboe@fb.com>
HOWTO
cconv.c
fio.1
io_u.c
options.c
stat.c
thread_options.h

diff --git a/HOWTO b/HOWTO
index e376ea5078ae3fdc0bf1d3fa4690987c728b2e60..5d378f3d9a75cf7c0e1cd7ca95f65ecaee060d58 100644 (file)
--- a/HOWTO
+++ b/HOWTO
@@ -2593,6 +2593,12 @@ Measurements and reporting
        all jobs in a file will be part of the same reporting group, unless
        separated by a :option:`stonewall`.
 
+.. option:: stats
+
+       By default, fio collects and shows final output results for all jobs
+       that run. If this option is set to 0, then fio will ignore it in
+       the final stat output.
+
 .. option:: write_bw_log=str
 
        If given, write a bandwidth log for this job. Can be used to store data of
diff --git a/cconv.c b/cconv.c
index b329bf47be991098180a14b9f1b158f6be5ca9b0..886140d414bef7271127e47d4a2b39ea111fa330 100644 (file)
--- a/cconv.c
+++ b/cconv.c
@@ -242,6 +242,7 @@ void convert_thread_options_to_cpu(struct thread_options *o,
        o->ioprio_class = le32_to_cpu(top->ioprio_class);
        o->file_service_type = le32_to_cpu(top->file_service_type);
        o->group_reporting = le32_to_cpu(top->group_reporting);
+       o->stats = le32_to_cpu(top->stats);
        o->fadvise_hint = le32_to_cpu(top->fadvise_hint);
        o->fallocate_mode = le32_to_cpu(top->fallocate_mode);
        o->zero_buffers = le32_to_cpu(top->zero_buffers);
@@ -426,6 +427,7 @@ void convert_thread_options_to_net(struct thread_options_pack *top,
        top->ioprio_class = cpu_to_le32(o->ioprio_class);
        top->file_service_type = cpu_to_le32(o->file_service_type);
        top->group_reporting = cpu_to_le32(o->group_reporting);
+       top->stats = cpu_to_le32(o->stats);
        top->fadvise_hint = cpu_to_le32(o->fadvise_hint);
        top->fallocate_mode = cpu_to_le32(o->fallocate_mode);
        top->zero_buffers = cpu_to_le32(o->zero_buffers);
diff --git a/fio.1 b/fio.1
index 3348513678780b6d86b6be67d2c22be9b5233bd6..b59025dc983375408350d6a09ba7afbb59428829 100644 (file)
--- a/fio.1
+++ b/fio.1
@@ -1548,6 +1548,10 @@ Wait for preceding jobs in the job file to exit before starting this one.
 Start a new reporting group.  If not given, all jobs in a file will be part
 of the same reporting group, unless separated by a stonewall.
 .TP
+.BI stats \fR=\fPbool
+By default, fio collects and shows final output results for all jobs that run.
+If this option is set to 0, then fio will ignore it in the final stat output.
+.TP
 .BI numjobs \fR=\fPint
 Number of clones (processes/threads performing the same workload) of this job.
 Default: 1.
diff --git a/io_u.c b/io_u.c
index cb8fc4ad606154a89b0ce8d0c99e36cae32deda2..f6efae056ec0cff552f2ac038cb770ad8ea948aa 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -1734,6 +1734,9 @@ static void account_io_completion(struct thread_data *td, struct io_u *io_u,
        if (td->parent)
                td = td->parent;
 
+       if (!td->o.stats)
+               return;
+
        if (no_reduce)
                lusec = utime_since(&io_u->issue_time, &icd->time);
 
@@ -1994,7 +1997,7 @@ int io_u_queued_complete(struct thread_data *td, int min_evts)
  */
 void io_u_queued(struct thread_data *td, struct io_u *io_u)
 {
-       if (!td->o.disable_slat && ramp_time_over(td)) {
+       if (!td->o.disable_slat && ramp_time_over(td) && td->o.stats) {
                unsigned long slat_time;
 
                slat_time = utime_since(&io_u->start_time, &io_u->issue_time);
index dcf0eeabba188c718170554e156e774d5d54250d..e0deab0a4d1020eed452078b521341a4c514bc15 100644 (file)
--- a/options.c
+++ b/options.c
@@ -3865,6 +3865,16 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .category = FIO_OPT_C_STAT,
                .group  = FIO_OPT_G_INVALID,
        },
+       {
+               .name   = "stats",
+               .lname  = "Stats",
+               .type   = FIO_OPT_BOOL,
+               .off1   = offsetof(struct thread_options, stats),
+               .help   = "Enable collection of stats",
+               .def    = "1",
+               .category = FIO_OPT_C_STAT,
+               .group  = FIO_OPT_G_INVALID,
+       },
        {
                .name   = "zero_buffers",
                .lname  = "Zero I/O buffers",
diff --git a/stat.c b/stat.c
index 0bb21d0093ac05a4e71cda24cea5cfde25ee916b..fde7af299de449d3f63afec10a548d8984ddc14c 100644 (file)
--- a/stat.c
+++ b/stat.c
@@ -1582,6 +1582,8 @@ void __show_run_stats(void)
                }
                if (last_ts == td->groupid)
                        continue;
+               if (!td->o.stats)
+                       continue;
 
                last_ts = td->groupid;
                nr_ts++;
@@ -1599,6 +1601,8 @@ void __show_run_stats(void)
        last_ts = -1;
        idx = 0;
        for_each_td(td, i) {
+               if (!td->o.stats)
+                       continue;
                if (idx && (!td->o.group_reporting ||
                    (td->o.group_reporting && last_ts != td->groupid))) {
                        idx = 0;
@@ -2569,6 +2573,8 @@ int calc_log_samples(void)
        fio_gettime(&now, NULL);
 
        for_each_td(td, i) {
+               if (!td->o.stats)
+                       continue;
                if (in_ramp_time(td) ||
                    !(td->runstate == TD_RUNNING || td->runstate == TD_VERIFYING)) {
                        next = min(td->o.iops_avg_time, td->o.bw_avg_time);
index 5e72867f234bec9c01b815911859b8ea415d62cf..2b2df3384fb12f5c24c311f32bc259515919d439 100644 (file)
@@ -206,6 +206,7 @@ struct thread_options {
        unsigned int ioprio_class;
        unsigned int file_service_type;
        unsigned int group_reporting;
+       unsigned int stats;
        unsigned int fadvise_hint;
        unsigned int fadvise_stream;
        enum fio_fallocate_mode fallocate_mode;
@@ -475,6 +476,7 @@ struct thread_options_pack {
        uint32_t ioprio_class;
        uint32_t file_service_type;
        uint32_t group_reporting;
+       uint32_t stats;
        uint32_t fadvise_hint;
        uint32_t fadvise_stream;
        uint32_t fallocate_mode;
@@ -502,7 +504,6 @@ struct thread_options_pack {
        uint64_t trim_backlog;
        uint32_t clat_percentiles;
        uint32_t percentile_precision;
-       uint32_t padding;       /* REMOVE ME when possible to maintain alignment */
        fio_fp64_t percentile_list[FIO_IO_U_LIST_MAX_LEN];
 
        uint8_t read_iolog_file[FIO_TOP_STR_MAX];