Fix rate option with iodepth > 1
authorRadha Ramachandran <radha@google.com>
Wed, 9 Dec 2009 21:31:44 +0000 (22:31 +0100)
committerJens Axboe <jens.axboe@oracle.com>
Wed, 9 Dec 2009 21:31:44 +0000 (22:31 +0100)
commitba3e4e0ca697f83c97a250d85a74506ace69de2c
treebc7631eaeac7b7189b23e373b3368dc980e83ab4
parentd2a1ed1a110d9c6f76a4a11974652c0bb9307b68
Fix rate option with iodepth > 1

The rate option currently doesnt work when used with libaio engine.
The math currently, calculates the time t2 (when the I/O completed) -
t1 (when the io_u unit was created) as the time it takes for the I/O
and the bandwidth for the rate calculation is calculated from that.
This math will work correctly for sync engine as there is only one io
in progress at a time, but for libaio engine, when there are multiple
I/Os queued, the same time (as in from t1 to t2) could be attributed
to other I/Os as well so the actual bandwidth is actually higher.
I have a patch, but this is more brute force where I take the total
bytes read/written divided by the time since I/Os started to calculate
the bandwidth and decide on the time that needs to be spent sleeping
(if any).This is a little more heavy weight than the previous math. I
think there are probably simpler/cleaner solutions than this but this
is the current patch I have for it.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
fio.h
gettime.c
init.c
io_u.c