From: Jens Axboe Date: Fri, 26 Sep 2014 16:01:50 +0000 (-0600) Subject: t/lfsr-test: fixup time X-Git-Tag: fio-2.1.13~38 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=48b944c48c196ebb5231c2e31d729822629ca1b7 t/lfsr-test: fixup time Signed-off-by: Jens Axboe --- diff --git a/fio_time.h b/fio_time.h index c550a55b..9f7d209a 100644 --- a/fio_time.h +++ b/fio_time.h @@ -1,6 +1,7 @@ #ifndef FIO_TIME_H #define FIO_TIME_H +struct thread_data; extern uint64_t utime_since(struct timeval *, struct timeval *); extern uint64_t utime_since_now(struct timeval *); extern uint64_t mtime_since(struct timeval *, struct timeval *); diff --git a/t/lfsr-test.c b/t/lfsr-test.c index 2eee0c64..4b542483 100644 --- a/t/lfsr-test.c +++ b/t/lfsr-test.c @@ -8,6 +8,8 @@ #include #include "../lib/lfsr.h" +#include "../gettime.h" +#include "../fio_time.h" void usage() { @@ -25,7 +27,7 @@ void usage() int main(int argc, char *argv[]) { int r; - struct timespec start, end; + struct timeval start, end; struct fio_lfsr *fl; int verify = 0; unsigned int spin = 0; @@ -113,8 +115,7 @@ int main(int argc, char *argv[]) } /* Calculate elapsed time and mean time per number */ - total = (end.tv_sec - start.tv_sec) * pow(10,9) + - end.tv_nsec - start.tv_nsec; + total = utime_since(&start, &end); mean = total / fl->num_vals; printf("\nTime results "); @@ -122,7 +123,7 @@ int main(int argc, char *argv[]) printf("(slower due to verification)"); printf("\n==============================\n"); printf("Elapsed: %lf s\n", total / pow(10,9)); - printf("Mean: %lf ns\n", mean); + printf("Mean: %lf us\n", mean); free(v_start); free(fl);