ts->percentile_list);
}
if (calc_lat(&ts->bw_stat[ddir], &min, &max, &mean, &dev)) {
- double p_of_agg;
+ double p_of_agg = 100.0;
const char *bw_str = "KB";
- p_of_agg = mean * 100 / (double) rs->agg[ddir];
- if (p_of_agg > 100.0)
- p_of_agg = 100.0;
+ if (rs->agg[ddir]) {
+ p_of_agg = mean * 100 / (double) rs->agg[ddir];
+ if (p_of_agg > 100.0)
+ p_of_agg = 100.0;
+ }
if (mean > 999999.9) {
min /= 1000.0;
free(ovals);
if (calc_lat(&ts->bw_stat[ddir], &min, &max, &mean, &dev)) {
- double p_of_agg;
+ double p_of_agg = 100.0;
+
+ if (rs->agg[ddir]) {
+ p_of_agg = mean * 100 / (double) rs->agg[ddir];
+ if (p_of_agg > 100.0)
+ p_of_agg = 100.0;
+ }
- p_of_agg = mean * 100 / (double) rs->agg[ddir];
log_info(";%lu;%lu;%f%%;%f;%f", min, max, p_of_agg, mean, dev);
} else
log_info(";%lu;%lu;%f%%;%f;%f", 0UL, 0UL, 0.0, 0.0, 0.0);
/* Additional output if continue_on_error set - default off*/
if (ts->continue_on_error)
log_info(";%lu;%d", ts->total_err_count, ts->first_error);
- log_info("\n");
/* Additional output if description is set */
if (strlen(ts->description))
log_info(";%s", ts->description);
+
+ log_info("\n");
}
static void show_thread_status_terse(struct thread_stat *ts,
if (spent < td->o.bw_avg_time)
return;
- rate = (td->this_io_bytes[ddir] - td->stat_io_bytes[ddir]) *
- 1000 / spent / 1024;
- add_stat_sample(&ts->bw_stat[ddir], rate);
+ /*
+ * Compute both read and write rates for the interval.
+ */
+ for (ddir = DDIR_READ; ddir <= DDIR_WRITE; ddir++) {
+ uint64_t delta;
+
+ delta = td->this_io_bytes[ddir] - td->stat_io_bytes[ddir];
+ if (!delta)
+ continue; /* No entries for interval */
- if (td->bw_log)
- add_log_sample(td, td->bw_log, rate, ddir, bs);
+ rate = delta * 1000 / spent / 1024;
+ add_stat_sample(&ts->bw_stat[ddir], rate);
+
+ if (td->bw_log)
+ add_log_sample(td, td->bw_log, rate, ddir, bs);
+
+ td->stat_io_bytes[ddir] = td->this_io_bytes[ddir];
+ }
fio_gettime(&td->bw_sample_time, NULL);
- td->stat_io_bytes[ddir] = td->this_io_bytes[ddir];
}
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 */
- add_stat_sample(&ts->iops_stat[ddir], iops);
+ iops = (delta * 1000) / spent;
+ 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];
}