From 48b944c48c196ebb5231c2e31d729822629ca1b7 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Fri, 26 Sep 2014 10:01:50 -0600 Subject: [PATCH] t/lfsr-test: fixup time Signed-off-by: Jens Axboe --- fio_time.h | 1 + t/lfsr-test.c | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) 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); -- 2.25.1