Improve accuracy of rate= option
authorSteven Lang <tirea@google.com>
Wed, 9 Nov 2011 12:48:01 +0000 (13:48 +0100)
committerJens Axboe <axboe@kernel.dk>
Wed, 9 Nov 2011 12:48:01 +0000 (13:48 +0100)
commit1b8dbf256b974fac2864052931f3041ff3ead157
treeec68e0dbdb54b9fbafea5c90b0e92825d7353b1d
parent75db6e2c168e895cd93504a7d20ddc853413e3b1
Improve accuracy of rate= option

I noticed that the rate= option is not terribly precise in some cases.
 It gets worse the higher the selected rate.  For example:
$ fio -name=load -size=100g -ioengine=null -runtime=10 -rate=30m
One would expect that to read 300MB (307200KB) at close to 30MB/s
(30720KB/s).  However it writes 315024KB at 31499KB/s.  Further
experimentation shows that even higher rates can show bigger
discrepancies.  At the extreme end...
$ fio -name=load -size=100g -ioengine=null -runtime=10 -rate=500m
One would expect this to write 5000MB at a rate of 500MB/s
(512000KB/s).  However it writes close to double that (9536.8MB) at a
rate of over 953MB/s.  At a rate of 1GB/s and higher, the rate
limiting is effectively ignored.

This patch improves the accuracy of the rate= option across the whole
range of rates, at the cost of being very slightly more
computationally expensive.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
fio.h
init.c
io_u.c