From 8243be59aa35aa016fcbeee99353b08376953911 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 16 Mar 2017 14:43:37 -0600 Subject: [PATCH] Add 'stats' option 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 --- HOWTO | 6 ++++++ cconv.c | 2 ++ fio.1 | 4 ++++ io_u.c | 5 ++++- options.c | 10 ++++++++++ stat.c | 6 ++++++ thread_options.h | 3 ++- 7 files changed, 34 insertions(+), 2 deletions(-) diff --git a/HOWTO b/HOWTO index e376ea50..5d378f3d 100644 --- 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 b329bf47..886140d4 100644 --- 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 33485136..b59025dc 100644 --- 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 cb8fc4ad..f6efae05 100644 --- 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); diff --git a/options.c b/options.c index dcf0eeab..e0deab0a 100644 --- 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 0bb21d00..fde7af29 100644 --- 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); diff --git a/thread_options.h b/thread_options.h index 5e72867f..2b2df338 100644 --- a/thread_options.h +++ b/thread_options.h @@ -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]; -- 2.25.1