display_lat("clat", min, max, mean, dev, out);
if (calc_lat(&ts->lat_stat[ddir], &min, &max, &mean, &dev))
display_lat(" lat", min, max, mean, dev, out);
+ if (calc_lat(&ts->clat_high_prio_stat[ddir], &min, &max, &mean, &dev))
+ display_lat("prio_clat", min, max, mean, dev, out);
if (ts->clat_percentiles || ts->lat_percentiles) {
const char *name = ts->clat_percentiles ? "clat" : " lat";
+ char prio_name[32];
uint64_t samples;
if (ts->clat_percentiles)
samples,
ts->percentile_list,
ts->percentile_precision, name, out);
+
+ /* Only print this if some high and low priority stats were collected */
+ if (ts->clat_high_prio_stat[ddir].samples > 0 &&
+ ts->clat_prio_stat[ddir].samples > 0)
+ {
+ sprintf(prio_name, "high prio (%.2f%%) %s",
+ 100. * (double) ts->clat_high_prio_stat[ddir].samples / (double) samples,
+ name);
+ show_clat_percentiles(ts->io_u_plat_high_prio[ddir],
+ ts->clat_high_prio_stat[ddir].samples,
+ ts->percentile_list,
+ ts->percentile_precision, prio_name, out);
+
+ sprintf(prio_name, "low prio (%.2f%%) %s",
+ 100. * (double) ts->clat_prio_stat[ddir].samples / (double) samples,
+ name);
+ show_clat_percentiles(ts->io_u_plat_prio[ddir],
+ ts->clat_prio_stat[ddir].samples,
+ ts->percentile_list,
+ ts->percentile_precision, prio_name, out);
+ }
}
if (calc_lat(&ts->bw_stat[ddir], &min, &max, &mean, &dev)) {
double p_of_agg = 100.0, fkb_base = (double)rs->kb_base;
}
}
+
+ /* Only print PRIO latencies if some high priority samples were gathered */
+ if (ts->clat_high_prio_stat[ddir].samples > 0) {
+ /* START OF HIGH PRIO CLAT */
+ if (!calc_lat(&ts->clat_high_prio_stat[ddir], &min, &max, &mean, &dev)) {
+ min = max = 0;
+ mean = dev = 0.0;
+ }
+ tmp_object = json_create_object();
+ json_object_add_value_object(dir_object, "clat_prio",
+ tmp_object);
+ json_object_add_value_int(tmp_object, "samples",
+ ts->clat_high_prio_stat[ddir].samples);
+ json_object_add_value_int(tmp_object, "min", min);
+ json_object_add_value_int(tmp_object, "max", max);
+ json_object_add_value_float(tmp_object, "mean", mean);
+ json_object_add_value_float(tmp_object, "stddev", dev);
+
+ if (ts->clat_percentiles) {
+ len = calc_clat_percentiles(ts->io_u_plat_high_prio[ddir],
+ ts->clat_high_prio_stat[ddir].samples,
+ ts->percentile_list, &ovals, &maxv,
+ &minv);
+ } else
+ len = 0;
+
+ percentile_object = json_create_object();
+ json_object_add_value_object(tmp_object, "percentile", percentile_object);
+ for (i = 0; i < FIO_IO_U_LIST_MAX_LEN; i++) {
+ if (i >= len) {
+ json_object_add_value_int(percentile_object, "0.00", 0);
+ continue;
+ }
+ snprintf(buf, sizeof(buf), "%f", ts->percentile_list[i].u.f);
+ json_object_add_value_int(percentile_object, (const char *)buf, ovals[i]);
+ }
+
+ if (output_format & FIO_OUTPUT_JSON_PLUS) {
+ clat_bins_object = json_create_object();
+ json_object_add_value_object(tmp_object, "bins", clat_bins_object);
+ for(i = 0; i < FIO_IO_U_PLAT_NR; i++) {
+ snprintf(buf, sizeof(buf), "%d", i);
+ json_object_add_value_int(clat_bins_object, (const char *)buf,
+ ts->io_u_plat_high_prio[ddir][i]);
+ }
+ json_object_add_value_int(clat_bins_object, "FIO_IO_U_PLAT_BITS",
+ FIO_IO_U_PLAT_BITS);
+ json_object_add_value_int(clat_bins_object, "FIO_IO_U_PLAT_VAL",
+ FIO_IO_U_PLAT_VAL);
+ json_object_add_value_int(clat_bins_object, "FIO_IO_U_PLAT_NR",
+ FIO_IO_U_PLAT_NR);
+ }
+ /* END OF HIGH PRIO CLAT */
+
+ /* START OF PRIO CLAT */
+ if (!calc_lat(&ts->clat_prio_stat[ddir], &min, &max, &mean, &dev)) {
+ min = max = 0;
+ mean = dev = 0.0;
+ }
+ tmp_object = json_create_object();
+ json_object_add_value_object(dir_object, "clat_low_prio",
+ tmp_object);
+ json_object_add_value_int(tmp_object, "samples",
+ ts->clat_prio_stat[ddir].samples);
+ json_object_add_value_int(tmp_object, "min", min);
+ json_object_add_value_int(tmp_object, "max", max);
+ json_object_add_value_float(tmp_object, "mean", mean);
+ json_object_add_value_float(tmp_object, "stddev", dev);
+
+ if (ts->clat_percentiles) {
+ len = calc_clat_percentiles(ts->io_u_plat_prio[ddir],
+ ts->clat_prio_stat[ddir].samples,
+ ts->percentile_list, &ovals, &maxv,
+ &minv);
+ } else
+ len = 0;
+
+ percentile_object = json_create_object();
+ json_object_add_value_object(tmp_object, "percentile", percentile_object);
+ for (i = 0; i < FIO_IO_U_LIST_MAX_LEN; i++) {
+ if (i >= len) {
+ json_object_add_value_int(percentile_object, "0.00", 0);
+ continue;
+ }
+ snprintf(buf, sizeof(buf), "%f", ts->percentile_list[i].u.f);
+ json_object_add_value_int(percentile_object, (const char *)buf, ovals[i]);
+ }
+
+ if (output_format & FIO_OUTPUT_JSON_PLUS) {
+ clat_bins_object = json_create_object();
+ json_object_add_value_object(tmp_object, "bins", clat_bins_object);
+ for(i = 0; i < FIO_IO_U_PLAT_NR; i++) {
+ snprintf(buf, sizeof(buf), "%d", i);
+ json_object_add_value_int(clat_bins_object, (const char *)buf,
+ ts->io_u_plat_prio[ddir][i]);
+ }
+ json_object_add_value_int(clat_bins_object, "FIO_IO_U_PLAT_BITS",
+ FIO_IO_U_PLAT_BITS);
+ json_object_add_value_int(clat_bins_object, "FIO_IO_U_PLAT_VAL",
+ FIO_IO_U_PLAT_VAL);
+ json_object_add_value_int(clat_bins_object, "FIO_IO_U_PLAT_NR",
+ FIO_IO_U_PLAT_NR);
+ }
+ /* END OF PRIO CLAT */
+ }
+
if (!ddir_rw(ddir))
return;
for (l = 0; l < DDIR_RWDIR_CNT; l++) {
if (!dst->unified_rw_rep) {
sum_stat(&dst->clat_stat[l], &src->clat_stat[l], first, false);
+ sum_stat(&dst->clat_high_prio_stat[l], &src->clat_high_prio_stat[l], first, false);
+ sum_stat(&dst->clat_prio_stat[l], &src->clat_prio_stat[l], first, false);
sum_stat(&dst->slat_stat[l], &src->slat_stat[l], first, false);
sum_stat(&dst->lat_stat[l], &src->lat_stat[l], first, false);
sum_stat(&dst->bw_stat[l], &src->bw_stat[l], first, true);
dst->runtime[l] = src->runtime[l];
} else {
sum_stat(&dst->clat_stat[0], &src->clat_stat[l], first, false);
+ sum_stat(&dst->clat_high_prio_stat[l], &src->clat_high_prio_stat[l], first, false);
+ sum_stat(&dst->clat_prio_stat[l], &src->clat_prio_stat[l], first, false);
sum_stat(&dst->slat_stat[0], &src->slat_stat[l], first, false);
sum_stat(&dst->lat_stat[0], &src->lat_stat[l], first, false);
sum_stat(&dst->bw_stat[0], &src->bw_stat[l], first, true);
int m;
for (m = 0; m < FIO_IO_U_PLAT_NR; m++) {
- if (!dst->unified_rw_rep)
+ if (!dst->unified_rw_rep) {
dst->io_u_plat[k][m] += src->io_u_plat[k][m];
- else
+ dst->io_u_plat_high_prio[k][m] += src->io_u_plat_high_prio[k][m];
+ dst->io_u_plat_prio[k][m] += src->io_u_plat_prio[k][m];
+ } else {
dst->io_u_plat[0][m] += src->io_u_plat[k][m];
+ dst->io_u_plat_high_prio[0][m] += src->io_u_plat_high_prio[k][m];
+ dst->io_u_plat_prio[0][m] += src->io_u_plat_prio[k][m];
+ }
+
}
}
ts->slat_stat[j].min_val = -1UL;
ts->bw_stat[j].min_val = -1UL;
ts->iops_stat[j].min_val = -1UL;
+ ts->clat_high_prio_stat[j].min_val = -1UL;
+ ts->clat_prio_stat[j].min_val = -1UL;
}
ts->sync_stat.min_val = -1UL;
ts->groupid = -1;
static void __add_log_sample(struct io_log *iolog, union io_sample_data data,
enum fio_ddir ddir, unsigned long long bs,
- unsigned long t, uint64_t offset)
+ unsigned long t, uint64_t offset, uint8_t priority_bit)
{
struct io_logs *cur_log;
s->time = t + (iolog->td ? iolog->td->unix_epoch : 0);
io_sample_set_ddir(iolog, s, ddir);
s->bs = bs;
+ s->priority_bit = priority_bit;
if (iolog->log_offset) {
struct io_sample_offset *so = (void *) s;
int i, j;
for (i = 0; i < DDIR_RWDIR_CNT; i++) {
+ reset_io_stat(&ts->clat_high_prio_stat[i]);
+ reset_io_stat(&ts->clat_prio_stat[i]);
reset_io_stat(&ts->clat_stat[i]);
reset_io_stat(&ts->slat_stat[i]);
reset_io_stat(&ts->lat_stat[i]);
for (j = 0; j < FIO_IO_U_PLAT_NR; j++) {
ts->io_u_plat[i][j] = 0;
+ ts->io_u_plat_high_prio[i][j] = 0;
+ ts->io_u_plat_prio[i][j] = 0;
if (!i)
ts->io_u_sync_plat[j] = 0;
}
}
static void __add_stat_to_log(struct io_log *iolog, enum fio_ddir ddir,
- unsigned long elapsed, bool log_max)
+ unsigned long elapsed, bool log_max, uint8_t priority_bit)
{
/*
* Note an entry in the log. Use the mean from the logged samples,
else
data.val = iolog->avg_window[ddir].mean.u.f + 0.50;
- __add_log_sample(iolog, data, ddir, 0, elapsed, 0);
+ __add_log_sample(iolog, data, ddir, 0, elapsed, 0, priority_bit);
}
reset_io_stat(&iolog->avg_window[ddir]);
}
static void _add_stat_to_log(struct io_log *iolog, unsigned long elapsed,
- bool log_max)
+ bool log_max, uint8_t priority_bit)
{
int ddir;
for (ddir = 0; ddir < DDIR_RWDIR_CNT; ddir++)
- __add_stat_to_log(iolog, ddir, elapsed, log_max);
+ __add_stat_to_log(iolog, ddir, elapsed, log_max, priority_bit);
}
static unsigned long add_log_sample(struct thread_data *td,
struct io_log *iolog,
union io_sample_data data,
enum fio_ddir ddir, unsigned long long bs,
- uint64_t offset)
+ uint64_t offset, uint8_t priority_bit)
{
unsigned long elapsed, this_window;
* If no time averaging, just add the log sample.
*/
if (!iolog->avg_msec) {
- __add_log_sample(iolog, data, ddir, bs, elapsed, offset);
+ __add_log_sample(iolog, data, ddir, bs, elapsed, offset, priority_bit);
return 0;
}
return diff;
}
- __add_stat_to_log(iolog, ddir, elapsed, td->o.log_max != 0);
+ _add_stat_to_log(iolog, elapsed, td->o.log_max != 0, priority_bit);
iolog->avg_last[ddir] = elapsed - (this_window - iolog->avg_msec);
return iolog->avg_msec;
elapsed = mtime_since_now(&td->epoch);
if (td->clat_log && unit_logs)
- _add_stat_to_log(td->clat_log, elapsed, td->o.log_max != 0);
+ _add_stat_to_log(td->clat_log, elapsed, td->o.log_max != 0, 0);
if (td->slat_log && unit_logs)
- _add_stat_to_log(td->slat_log, elapsed, td->o.log_max != 0);
+ _add_stat_to_log(td->slat_log, elapsed, td->o.log_max != 0, 0);
if (td->lat_log && unit_logs)
- _add_stat_to_log(td->lat_log, elapsed, td->o.log_max != 0);
+ _add_stat_to_log(td->lat_log, elapsed, td->o.log_max != 0, 0);
if (td->bw_log && (unit_logs == per_unit_log(td->bw_log)))
- _add_stat_to_log(td->bw_log, elapsed, td->o.log_max != 0);
+ _add_stat_to_log(td->bw_log, elapsed, td->o.log_max != 0, 0);
if (td->iops_log && (unit_logs == per_unit_log(td->iops_log)))
- _add_stat_to_log(td->iops_log, elapsed, td->o.log_max != 0);
+ _add_stat_to_log(td->iops_log, elapsed, td->o.log_max != 0, 0);
}
-void add_agg_sample(union io_sample_data data, enum fio_ddir ddir, unsigned long long bs)
+void add_agg_sample(union io_sample_data data, enum fio_ddir ddir, unsigned long long bs,
+ uint8_t priority_bit)
{
struct io_log *iolog;
return;
iolog = agg_io_log[ddir];
- __add_log_sample(iolog, data, ddir, bs, mtime_since_genesis(), 0);
+ __add_log_sample(iolog, data, ddir, bs, mtime_since_genesis(), 0, priority_bit);
}
void add_sync_clat_sample(struct thread_stat *ts, unsigned long long nsec)
}
static void add_clat_percentile_sample(struct thread_stat *ts,
- unsigned long long nsec, enum fio_ddir ddir)
+ unsigned long long nsec, enum fio_ddir ddir, uint8_t priority_bit)
{
unsigned int idx = plat_val_to_idx(nsec);
assert(idx < FIO_IO_U_PLAT_NR);
ts->io_u_plat[ddir][idx]++;
+
+ if (!priority_bit) {
+ ts->io_u_plat_prio[ddir][idx]++;
+ } else {
+ ts->io_u_plat_high_prio[ddir][idx]++;
+ }
}
void add_clat_sample(struct thread_data *td, enum fio_ddir ddir,
unsigned long long nsec, unsigned long long bs,
- uint64_t offset)
+ uint64_t offset, uint8_t priority_bit)
{
const bool needs_lock = td_async_processing(td);
unsigned long elapsed, this_window;
add_stat_sample(&ts->clat_stat[ddir], nsec);
+ if (priority_bit) {
+ add_stat_sample(&ts->clat_high_prio_stat[ddir], nsec);
+ } else {
+ add_stat_sample(&ts->clat_prio_stat[ddir], nsec);
+ }
+
if (td->clat_log)
add_log_sample(td, td->clat_log, sample_val(nsec), ddir, bs,
- offset);
+ offset, priority_bit);
- if (ts->clat_percentiles)
- add_clat_percentile_sample(ts, nsec, ddir);
+ if (ts->clat_percentiles) {
+ add_clat_percentile_sample(ts, nsec, ddir, priority_bit);
+ }
if (iolog && iolog->hist_msec) {
struct io_hist *hw = &iolog->hist_window[ddir];
FIO_IO_U_PLAT_NR * sizeof(uint64_t));
flist_add(&dst->list, &hw->list);
__add_log_sample(iolog, sample_plat(dst), ddir, bs,
- elapsed, offset);
+ elapsed, offset, priority_bit);
/*
* Update the last time we recorded as being now, minus
}
void add_slat_sample(struct thread_data *td, enum fio_ddir ddir,
- unsigned long usec, unsigned long long bs, uint64_t offset)
+ unsigned long usec, unsigned long long bs, uint64_t offset,
+ uint8_t priority_bit)
{
const bool needs_lock = td_async_processing(td);
struct thread_stat *ts = &td->ts;
add_stat_sample(&ts->slat_stat[ddir], usec);
if (td->slat_log)
- add_log_sample(td, td->slat_log, sample_val(usec), ddir, bs, offset);
+ add_log_sample(td, td->slat_log, sample_val(usec), ddir, bs, offset,
+ priority_bit);
if (needs_lock)
__td_io_u_unlock(td);
void add_lat_sample(struct thread_data *td, enum fio_ddir ddir,
unsigned long long nsec, unsigned long long bs,
- uint64_t offset)
+ uint64_t offset, uint8_t priority_bit)
{
const bool needs_lock = td_async_processing(td);
struct thread_stat *ts = &td->ts;
if (td->lat_log)
add_log_sample(td, td->lat_log, sample_val(nsec), ddir, bs,
- offset);
+ offset, priority_bit);
if (ts->lat_percentiles)
- add_clat_percentile_sample(ts, nsec, ddir);
+ add_clat_percentile_sample(ts, nsec, ddir, priority_bit);
if (needs_lock)
__td_io_u_unlock(td);
if (td->bw_log)
add_log_sample(td, td->bw_log, sample_val(rate), io_u->ddir,
- bytes, io_u->offset);
+ bytes, io_u->offset, io_u_is_prio(io_u));
td->stat_io_bytes[io_u->ddir] = td->this_io_bytes[io_u->ddir];
if (td->o.min_bs[ddir] == td->o.max_bs[ddir])
bs = td->o.min_bs[ddir];
- next = add_log_sample(td, log, sample_val(rate), ddir, bs, 0);
+ next = add_log_sample(td, log, sample_val(rate), ddir, bs, 0, 0);
next_log = min(next_log, next);
}
if (td->iops_log)
add_log_sample(td, td->iops_log, sample_val(1), io_u->ddir,
- bytes, io_u->offset);
+ bytes, io_u->offset, io_u_is_prio(io_u));
td->stat_io_blocks[io_u->ddir] = td->this_io_blocks[io_u->ddir];