From: Niklas Cassel <niklas.cassel@xxxxxxx> add_lat_percentile_prio_sample() currently adds both a per priority sample and a regular sample. Since these two samples are completely unrelated, it is very confusing that the add_lat_percentile_prio_sample() also adds a regular sample. Remove the add_lat_percentile_sample() function call from add_lat_percentile_prio_sample(), and let functions calling add_lat_percentile_prio_sample() call add_lat_percentile_sample() explicitly. This makes the flow in e.g. add_clat_sample() much easier to follow. Signed-off-by: Niklas Cassel <niklas.cassel@xxxxxxx> Reviewed-by: Damien Le Moal <damien.lemoal@xxxxxxxxxxxxxxxxxx> --- stat.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/stat.c b/stat.c index 28e49a89..f78899c8 100644 --- a/stat.c +++ b/stat.c @@ -3065,12 +3065,10 @@ static void add_lat_percentile_sample(struct thread_stat *ts, static void add_lat_percentile_prio_sample(struct thread_stat *ts, unsigned long long nsec, enum fio_ddir ddir, - bool high_prio, enum fio_lat lat) + bool high_prio) { unsigned int idx = plat_val_to_idx(nsec); - add_lat_percentile_sample(ts, nsec, ddir, lat); - if (!high_prio) ts->io_u_plat_low_prio[ddir][idx]++; else @@ -3117,11 +3115,10 @@ void add_clat_sample(struct thread_data *td, enum fio_ddir ddir, * sample only when lat_percentiles=0. add_lat_sample() will add * the prio lat percentile sample when lat_percentiles=1. */ - if (ts->lat_percentiles) - add_lat_percentile_sample(ts, nsec, ddir, FIO_CLAT); - else - add_lat_percentile_prio_sample(ts, nsec, ddir, high_prio, - FIO_CLAT); + add_lat_percentile_sample(ts, nsec, ddir, FIO_CLAT); + if (!ts->lat_percentiles) + add_lat_percentile_prio_sample(ts, nsec, ddir, + high_prio); } if (iolog && iolog->hist_msec) { @@ -3222,8 +3219,8 @@ void add_lat_sample(struct thread_data *td, enum fio_ddir ddir, * lat_percentiles=0. */ if (ts->lat_percentiles) { - add_lat_percentile_prio_sample(ts, nsec, ddir, high_prio, - FIO_LAT); + add_lat_percentile_sample(ts, nsec, ddir, FIO_LAT); + add_lat_percentile_prio_sample(ts, nsec, ddir, high_prio); if (high_prio) add_stat_sample(&ts->clat_high_prio_stat[ddir], nsec); else -- 2.33.1