From af1600c115240ac4feb8df649e7d815988a27126 Mon Sep 17 00:00:00 2001 From: Sitsofe Wheeler Date: Sun, 31 Dec 2017 11:41:55 +0000 Subject: [PATCH] stat: make lat_percentiles=1 use sample count from lat_stat The following job ./fio --name=nolatencies --ioengine=posixaio --direct=1 --rw=randread \ --iodepth=1 --bs=4k --filename=/tmp/fio.tmp --runtime=2s --size=50m \ --disable_lat=0 --disable_clat=1 --disable_slat=1 --lat_percentiles=1 outputs the following: fio-3.3 Starting 1 process test: (groupid=0, jobs=1): err= 0: pid=7316: Sun Dec 31 11:55:46 2017 read: IOPS=41.0k, BW=164MiB/s (172MB/s)(50.0MiB/305msec) lat (usec): min=8, max=132, avg=17.58, stdev= 4.36 lat percentiles (nsec): | 1.00th=[ 0], 5.00th=[ 0], 10.00th=[ 0], 20.00th=[ 0], | 30.00th=[ 0], 40.00th=[ 0], 50.00th=[ 0], 60.00th=[ 0], | 70.00th=[ 0], 80.00th=[ 0], 90.00th=[ 0], 95.00th=[ 0], | 99.00th=[ 0], 99.50th=[ 0], 99.90th=[ 0], 99.95th=[ 0], | 99.99th=[ 0] cpu : usr=56.39%, sys=29.18%, ctx=12043, majf=0, minf=85 IO depths : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0% submit : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0% complete : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0% issued rwt: total=12800,0,0, short=0,0,0, dropped=0,0,0 latency : target=0, window=0, percentile=100.00%, depth=1 Run status group 0 (all jobs): READ: bw=164MiB/s (172MB/s), 164MiB/s-164MiB/s (172MB/s-172MB/s), io=50.0MiB (52.4MB), run=305-305msec which isn't showing total latency percentiles (lat percentiles) when it should. Additionally there is a segfault when running the following job: ./fio --name=segfault --ioengine=posixaio --direct=1 --rw=randread \ --iodepth=1 --bs=4k --filename=/tmp/fio.tmp --runtime=2s --size=50m \ --disable_lat=1 --disable_clat=0 --disable_slat=1 --lat_percentiles=1 Fix these by making latency printing use the number of samples from the correct latency type (clat_stat for lat_percentiles=0/clat_percentiles=1 and lat_stat for lat_percentiles=1/clat_percentiles=0). Fixes https://www.spinics.net/lists/fio/msg06628.html ("fio lat reporting "). Reported-by: Jeff Furlong Signed-off-by: Sitsofe Wheeler --- stat.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/stat.c b/stat.c index 863aa45d..cc171a4d 100644 --- a/stat.c +++ b/stat.c @@ -460,8 +460,15 @@ static void show_ddir_status(struct group_run_stats *rs, struct thread_stat *ts, display_lat(" lat", min, max, mean, dev, out); if (ts->clat_percentiles || ts->lat_percentiles) { + uint64_t samples; + + if (ts->clat_percentiles) + samples = ts->clat_stat[ddir].samples; + else + samples = ts->lat_stat[ddir].samples; + show_clat_percentiles(ts->io_u_plat[ddir], - ts->clat_stat[ddir].samples, + samples, ts->percentile_list, ts->percentile_precision, ts->clat_percentiles, out); -- 2.25.1