stat: fix calculation of bw and iops statistics based on samples
authorMaciej S. Szmigiero <maciej.szmigiero@oracle.com>
Tue, 28 Jan 2020 20:39:15 +0000 (21:39 +0100)
committerMaciej S. Szmigiero <maciej.szmigiero@oracle.com>
Tue, 28 Jan 2020 20:42:59 +0000 (21:42 +0100)
commitcdb8308d5d69d7e465473e1f39f5e78d027715da
tree271e23b0214d29110905be37cff8f73083e72b00
parent8178434ccba8e2d06684ce0c730b0eda571c5280
stat: fix calculation of bw and iops statistics based on samples

It is obvious on many runs that bw and iops averages from statistics based
on samples are way off (sometimes by an order of magnitude) in comparison
to the main numbers reported for these values.

When sampling these values fio assumes that their each next averaging
interval starts exactly the set averaging interval later from the start of
the previous averaging interval.

However, this isn't necessary true as scheduling delays may lengthen such
intervals, so the next one should start when the previous one has actually
ended, since that's when the collected totals are counted.

On my test system (with fio set to the default averaging interval length of
500 msec) the actual lengths are usually around 650 msec, however
700+ msec intervals aren't unusual.

This causes pretty significant bw and iops measurement discrepancy between
the sample-based values and the overall measurements.

Let's make sure that we use the actual end time of the previous averaging
interval as the beginning of the next averaging interval.

With this change the bw and iops sample-based values become almost the
same as the main numbers reported.

Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
stat.c