X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=stat.c;h=e72148b49ad0825f3e154bda0a1a303715f70764;hb=ae2fafc8525e980b8271e3230a0fd4da660fddda;hp=68744281a92de519cbb1f350fb459dfcca517cfd;hpb=5daa4ebed724cb0223dac4a1386e068f59722dab;p=fio.git diff --git a/stat.c b/stat.c index 68744281..e72148b4 100644 --- a/stat.c +++ b/stat.c @@ -786,7 +786,7 @@ static void show_thread_status_terse_v3(struct thread_stat *ts, /* Additional output if description is set */ if (strlen(ts->description)) - log_info(";%s", ts->description); + log_info(";%s\n", ts->description); } static void show_thread_status_terse(struct thread_stat *ts, @@ -1291,8 +1291,8 @@ void add_bw_sample(struct thread_data *td, enum fio_ddir ddir, unsigned int bs, spent = mtime_since(&td->bw_sample_time, t); if (spent < td->o.bw_avg_time) return; - - /* + + /* * Compute both read and write rates for the interval. */ for (ddir = DDIR_READ; ddir <= DDIR_WRITE; ddir++) { @@ -1327,13 +1327,24 @@ void add_iops_sample(struct thread_data *td, enum fio_ddir ddir, if (spent < td->o.iops_avg_time) return; - iops = ((td->this_io_blocks[ddir] - td->stat_io_blocks[ddir]) * 1000) / spent; + /* + * Compute both read and write rates for the interval. + */ + for (ddir = DDIR_READ; ddir <= DDIR_WRITE; ddir++) { + uint64_t delta; + + delta = td->this_io_blocks[ddir] - td->stat_io_blocks[ddir]; + if (!delta) + continue; /* No entries for interval */ + + iops = (delta * 1000) / spent; + add_stat_sample(&ts->iops_stat[ddir], iops); - add_stat_sample(&ts->iops_stat[ddir], iops); + if (td->iops_log) + add_log_sample(td, td->iops_log, iops, ddir, 0); - if (td->iops_log) - add_log_sample(td, td->iops_log, iops, ddir, 0); + td->stat_io_blocks[ddir] = td->this_io_blocks[ddir]; + } fio_gettime(&td->iops_sample_time, NULL); - td->stat_io_blocks[ddir] = td->this_io_blocks[ddir]; }