summaryrefslogtreecommitdiff
path: root/gettime.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2012-12-10 10:15:59 +0100
committerJens Axboe <axboe@kernel.dk>2012-12-10 10:15:59 +0100
commitd7abad3d0a2aab71707264ae088ecc19c88585dc (patch)
tree4b9e7d094dee4267f4a8fe5c458dd555b3871c51 /gettime.c
parent89db727d5baaf32bc665c2addd844da5541249bb (diff)
downloadfio-d7abad3d0a2aab71707264ae088ecc19c88585dc.tar.gz
fio-d7abad3d0a2aab71707264ae088ecc19c88585dc.tar.bz2
cpu clock: round up when dividing by samples
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'gettime.c')
-rw-r--r--gettime.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gettime.c b/gettime.c
index df42c29c..1ba18e99 100644
--- a/gettime.c
+++ b/gettime.c
@@ -247,7 +247,8 @@ static void calibrate_cpu_clock(void)
for (i = 0; i < NR_TIME_ITERS; i++)
dprint(FD_TIME, "cycles[%d]=%lu\n", i, cycles[i] / 10);
- avg /= (samples * 10);
+ avg /= samples;
+ avg = (avg + 9) / 10;
dprint(FD_TIME, "avg: %lu\n", avg);
dprint(FD_TIME, "mean=%f, S=%f\n", mean, S);