X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=t%2Flfsr-test.c;h=4b255e19bb07445bfe9564807676123b06cd75af;hb=7d7a704638a1e957c845c04eeac82bdeda0c674c;hp=901f1a66bfb30e2184391c1365872d1a646465af;hpb=dd9bd2b2e0ed9665325240fdd5a40253fe23bca6;p=fio.git diff --git a/t/lfsr-test.c b/t/lfsr-test.c index 901f1a66..4b255e19 100644 --- a/t/lfsr-test.c +++ b/t/lfsr-test.c @@ -1,17 +1,14 @@ #include #include -#include #include #include -#include -#include -#include #include "../lib/lfsr.h" #include "../gettime.h" #include "../fio_time.h" +#include "../compiler/compiler.h" -void usage() +static void usage(void) { printf("Usage: lfsr-test 0x [seed] [spin] [verify]\n"); printf("-------------------------------------------------------------\n"); @@ -27,7 +24,7 @@ void usage() int main(int argc, char *argv[]) { int r; - struct timeval start, end; + struct timespec start, end; struct fio_lfsr *fl; int verify = 0; unsigned int spin = 0; @@ -38,12 +35,17 @@ 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) - verify = 1; + verify = 1; + fio_fallthrough; case 4: spin = atoi(argv[3]); + fio_fallthrough; case 3: seed = atol(argv[2]); + fio_fallthrough; case 2: numbers = strtol(argv[1], NULL, 16); break; default: usage(); @@ -78,7 +80,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; @@ -122,7 +124,7 @@ int main(int argc, char *argv[]) if (verify) printf("(slower due to verification)"); printf("\n==============================\n"); - printf("Elapsed: %lf s\n", total / pow(10,9)); + printf("Elapsed: %lf s\n", total / pow(10,6)); printf("Mean: %lf us\n", mean); free(v_start);