stat: make lat_percentiles=1 use sample count from lat_stat
authorSitsofe Wheeler <sitsofe@yahoo.com>
Sun, 31 Dec 2017 11:41:55 +0000 (11:41 +0000)
committerSitsofe Wheeler <sitsofe@yahoo.com>
Sun, 31 Dec 2017 12:56:15 +0000 (12:56 +0000)
commitaf1600c115240ac4feb8df649e7d815988a27126
treec817976c5be6eab114cb66f9bb79a8439de0bdf5
parentdf4bf1178ed773986129da6038961388af926971
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 <jeff.furlong@wdc.com>
Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
stat.c