diff options
Diffstat (limited to 'tables/tables.c')
| -rw-r--r-- | tables/tables.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tables/tables.c b/tables/tables.c new file mode 100644 index 0000000..bd37831 --- /dev/null +++ b/tables/tables.c | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | #define _POSIX_C_SOURCE 200809L /* Required to use clock_gettime */ | ||
| 2 | |||
| 3 | #include <inttypes.h> | ||
| 4 | #include <stdbool.h> | ||
| 5 | #include <stdio.h> | ||
| 6 | #include <stdlib.h> | ||
| 7 | #include <time.h> | ||
| 8 | |||
| 9 | #include "../src/cube.h" | ||
| 10 | |||
| 11 | #define SIZE_H1 118687270 | ||
| 12 | |||
| 13 | char buf[SIZE_H1]; | ||
| 14 | |||
| 15 | int main(int argc, char *argv[]) { | ||
| 16 | FILE *f; | ||
| 17 | struct timespec t0, t1; | ||
| 18 | double s; | ||
| 19 | |||
| 20 | clock_gettime(CLOCK_MONOTONIC, &t0); | ||
| 21 | gendata("H48", argc > 1 ? argv[1] : "4", buf); | ||
| 22 | clock_gettime(CLOCK_MONOTONIC, &t1); | ||
| 23 | |||
| 24 | if ((f = fopen("tables/data/h48_test", "wb")) == NULL) { | ||
| 25 | printf("Could not open file!\n"); | ||
| 26 | return 1; | ||
| 27 | } | ||
| 28 | fwrite(buf, SIZE_H1, 1, f); | ||
| 29 | |||
| 30 | s = t1.tv_sec - t0.tv_sec + (t1.tv_nsec - t0.tv_nsec) / 1000000000.0; | ||
| 31 | printf("Data generated in %lfs\n", s); | ||
| 32 | |||
| 33 | return 0; | ||
| 34 | } | ||
