From 9f2cd5e0ccbce6b65276c1401cdcf2cb8b77b9ff Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Sat, 22 Sep 2018 15:02:04 -0600 Subject: [PATCH] stat: print the right percentile variant for json output We always show the clat percentiles for the json output, regardless of whether lat_percentiles or clat_percentiles was defined in the job. Correct that so we show the right output depending on the job setting. Fixes: https://github.com/axboe/fio/issues/691 Signed-off-by: Jens Axboe --- stat.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/stat.c b/stat.c index 5fca9984..ef9c4af2 100644 --- a/stat.c +++ b/stat.c @@ -1059,10 +1059,16 @@ static void add_ddir_status_json(struct thread_stat *ts, if (ts->clat_percentiles || ts->lat_percentiles) { if (ddir_rw(ddir)) { + uint64_t samples; + + if (ts->clat_percentiles) + samples = ts->clat_stat[ddir].samples; + else + samples = ts->lat_stat[ddir].samples; + len = calc_clat_percentiles(ts->io_u_plat[ddir], - ts->clat_stat[ddir].samples, - ts->percentile_list, &ovals, &maxv, - &minv); + samples, ts->percentile_list, &ovals, + &maxv, &minv); } else { len = calc_clat_percentiles(ts->io_u_sync_plat, ts->sync_stat.samples, -- 2.25.1