stat: print the right percentile variant for json output
authorJens Axboe <axboe@kernel.dk>
Sat, 22 Sep 2018 21:02:04 +0000 (15:02 -0600)
committerJens Axboe <axboe@kernel.dk>
Sat, 22 Sep 2018 21:02:04 +0000 (15:02 -0600)
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 <axboe@kernel.dk>
stat.c

diff --git a/stat.c b/stat.c
index 5fca99845ff88d10b9c4b96d1b76b37672170349..ef9c4af2d81878a1ec6ec427cc804c18f7b07752 100644 (file)
--- 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,