X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=t%2Flfsr-test.c;h=901f1a66bfb30e2184391c1365872d1a646465af;hb=37659335ac616d7c13bf8bfbb76366424b50ea67;hp=2eee0c648e50aad5b3264f7407bc858dd4ad70cc;hpb=9077ee4ae85d3a4519f99372b884ec7d9fd3e781;p=fio.git diff --git a/t/lfsr-test.c b/t/lfsr-test.c index 2eee0c64..901f1a66 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; @@ -87,7 +89,7 @@ int main(int argc, char *argv[]) */ fprintf(stderr, "\nTest initiated... "); fio_gettime(&start, NULL); - while (!lfsr_next(fl, &i, fl->max_val)) { + while (!lfsr_next(fl, &i)) { if (verify) *(uint8_t *)(v + i) += 1; } @@ -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);