cpu clock: round up when dividing by samples
authorJens Axboe <axboe@kernel.dk>
Mon, 10 Dec 2012 09:15:59 +0000 (10:15 +0100)
committerJens Axboe <axboe@kernel.dk>
Mon, 10 Dec 2012 09:15:59 +0000 (10:15 +0100)
Signed-off-by: Jens Axboe <axboe@kernel.dk>
gettime.c

index df42c29..1ba18e9 100644 (file)
--- 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);