The following changes since commit 2b00ac1c82d54795911343c9b3b3f4ef64c92d92: Merge branch 'fix-parse-sync-file-range' of https://github.com/oleglatin/fio (2021-11-24 10:27:20 -0700) are available in the Git repository at: git://git.kernel.dk/fio.git master for you to fetch changes up to ed7f3a07363d62c6d6147b0c568f87f079d241a8: stat: make add lat percentile functions inline (2021-11-25 09:03:10 -0700) ---------------------------------------------------------------- Niklas Cassel (6): docs: document quirky implementation of per priority stats reporting stat: add comments describing the quirky behavior of clat prio samples stat: rename add_lat_percentile_sample() stat: rename add_lat_percentile_sample_noprio() stat: simplify add_lat_percentile_prio_sample() stat: make add lat percentile functions inline HOWTO | 6 +++++- fio.1 | 5 ++++- stat.c | 52 +++++++++++++++++++++++++++++++++++++++------------- 3 files changed, 48 insertions(+), 15 deletions(-) --- Diff of recent changes: diff --git a/HOWTO b/HOWTO index a3b3acfe..8c9e4135 100644 --- a/HOWTO +++ b/HOWTO @@ -2169,7 +2169,11 @@ with the caveat that when used on the command line, they must come after the Default: 0. A single value applies to reads and writes. Comma-separated values may be specified for reads and writes. For this option to be effective, NCQ priority must be supported and enabled, and `direct=1' - option must be used. fio must also be run as the root user. + option must be used. fio must also be run as the root user. Unlike + slat/clat/lat stats, which can be tracked and reported independently, per + priority stats only track and report a single type of latency. By default, + completion latency (clat) will be reported, if :option:`lat_percentiles` is + set, total latency (lat) will be reported. .. option:: cmdprio_class=int[,int] : [io_uring] [libaio] diff --git a/fio.1 b/fio.1 index a6469541..a3ebb67d 100644 --- a/fio.1 +++ b/fio.1 @@ -1967,7 +1967,10 @@ Set the percentage of I/O that will be issued with the highest priority. Default: 0. A single value applies to reads and writes. Comma-separated values may be specified for reads and writes. For this option to be effective, NCQ priority must be supported and enabled, and `direct=1' option must be -used. fio must also be run as the root user. +used. fio must also be run as the root user. Unlike slat/clat/lat stats, which +can be tracked and reported independently, per priority stats only track and +report a single type of latency. By default, completion latency (clat) will be +reported, if \fBlat_percentiles\fR is set, total latency (lat) will be reported. .TP .BI (io_uring,libaio)cmdprio_class \fR=\fPint[,int] Set the I/O priority class to use for I/Os that must be issued with a diff --git a/stat.c b/stat.c index e0dc99b6..7e84058d 100644 --- a/stat.c +++ b/stat.c @@ -3052,8 +3052,10 @@ void add_sync_clat_sample(struct thread_stat *ts, unsigned long long nsec) add_stat_sample(&ts->sync_stat, nsec); } -static void add_lat_percentile_sample_noprio(struct thread_stat *ts, - unsigned long long nsec, enum fio_ddir ddir, enum fio_lat lat) +static inline void add_lat_percentile_sample(struct thread_stat *ts, + unsigned long long nsec, + enum fio_ddir ddir, + enum fio_lat lat) { unsigned int idx = plat_val_to_idx(nsec); assert(idx < FIO_IO_U_PLAT_NR); @@ -3061,14 +3063,13 @@ static void add_lat_percentile_sample_noprio(struct thread_stat *ts, ts->io_u_plat[lat][ddir][idx]++; } -static void add_lat_percentile_sample(struct thread_stat *ts, - unsigned long long nsec, enum fio_ddir ddir, - bool high_prio, enum fio_lat lat) +static inline void add_lat_percentile_prio_sample(struct thread_stat *ts, + unsigned long long nsec, + enum fio_ddir ddir, + bool high_prio) { unsigned int idx = plat_val_to_idx(nsec); - add_lat_percentile_sample_noprio(ts, nsec, ddir, lat); - if (!high_prio) ts->io_u_plat_low_prio[ddir][idx]++; else @@ -3089,6 +3090,15 @@ void add_clat_sample(struct thread_data *td, enum fio_ddir ddir, add_stat_sample(&ts->clat_stat[ddir], nsec); + /* + * When lat_percentiles=1 (default 0), the reported high/low priority + * percentiles and stats are used for describing total latency values, + * even though the variable names themselves start with clat_. + * + * Because of the above definition, add a prio stat sample only when + * lat_percentiles=0. add_lat_sample() will add the prio stat sample + * when lat_percentiles=1. + */ if (!ts->lat_percentiles) { if (high_prio) add_stat_sample(&ts->clat_high_prio_stat[ddir], nsec); @@ -3101,10 +3111,15 @@ void add_clat_sample(struct thread_data *td, enum fio_ddir ddir, offset, ioprio); if (ts->clat_percentiles) { - if (ts->lat_percentiles) - add_lat_percentile_sample_noprio(ts, nsec, ddir, FIO_CLAT); - else - add_lat_percentile_sample(ts, nsec, ddir, high_prio, FIO_CLAT); + /* + * Because of the above definition, add a prio lat percentile + * sample only when lat_percentiles=0. add_lat_sample() will add + * the prio lat percentile sample when lat_percentiles=1. + */ + 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) { @@ -3169,7 +3184,7 @@ void add_slat_sample(struct thread_data *td, enum fio_ddir ddir, offset, ioprio); if (ts->slat_percentiles) - add_lat_percentile_sample_noprio(ts, nsec, ddir, FIO_SLAT); + add_lat_percentile_sample(ts, nsec, ddir, FIO_SLAT); if (needs_lock) __td_io_u_unlock(td); @@ -3194,8 +3209,19 @@ void add_lat_sample(struct thread_data *td, enum fio_ddir ddir, add_log_sample(td, td->lat_log, sample_val(nsec), ddir, bs, offset, ioprio); + /* + * When lat_percentiles=1 (default 0), the reported high/low priority + * percentiles and stats are used for describing total latency values, + * even though the variable names themselves start with clat_. + * + * Because of the above definition, add a prio stat and prio lat + * percentile sample only when lat_percentiles=1. add_clat_sample() will + * add the prio stat and prio lat percentile sample when + * lat_percentiles=0. + */ if (ts->lat_percentiles) { - add_lat_percentile_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