X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=t%2Flfsr-test.c;h=a01f2cfcb43c2cf963f69675bd462eb7f0f2fa33;hb=b3ce355dc217876b762d43dff663bbb45e5da653;hp=2eee0c648e50aad5b3264f7407bc858dd4ad70cc;hpb=9077ee4ae85d3a4519f99372b884ec7d9fd3e781;p=fio.git diff --git a/t/lfsr-test.c b/t/lfsr-test.c index 2eee0c64..a01f2cfc 100644 --- a/t/lfsr-test.c +++ b/t/lfsr-test.c @@ -1,15 +1,13 @@ #include #include -#include #include #include -#include -#include -#include #include "../lib/lfsr.h" +#include "../gettime.h" +#include "../fio_time.h" -void usage() +static void usage(void) { printf("Usage: lfsr-test 0x [seed] [spin] [verify]\n"); printf("-------------------------------------------------------------\n"); @@ -36,6 +34,8 @@ int main(int argc, char *argv[]) void *v = NULL, *v_start; double total, mean; + arch_init(argv); + /* Read arguments */ switch (argc) { case 5: if (strncmp(argv[4], "verify", 7) == 0) @@ -76,7 +76,7 @@ int main(int argc, char *argv[]) v_size = numbers * sizeof(uint8_t); v = malloc(v_size); memset(v, 0, v_size); - printf("\nVerification table is %lf KBs\n", (double)(v_size) / 1024); + printf("\nVerification table is %lf KiB\n", (double)(v_size) / 1024); } v_start = v; @@ -87,7 +87,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,16 +113,15 @@ 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 "); if (verify) printf("(slower due to verification)"); printf("\n==============================\n"); - printf("Elapsed: %lf s\n", total / pow(10,9)); - printf("Mean: %lf ns\n", mean); + printf("Elapsed: %lf s\n", total / pow(10,6)); + printf("Mean: %lf us\n", mean); free(v_start); free(fl);