From 8954b4b7eaafa8e306f2aa6cbb7e32334107e6e1 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Fri, 24 May 2024 22:20:00 +0200 Subject: Added table generation utility --- tables/tables.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 tables/tables.c (limited to 'tables') 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 @@ +#define _POSIX_C_SOURCE 200809L /* Required to use clock_gettime */ + +#include +#include +#include +#include +#include + +#include "../src/cube.h" + +#define SIZE_H1 118687270 + +char buf[SIZE_H1]; + +int main(int argc, char *argv[]) { + FILE *f; + struct timespec t0, t1; + double s; + + clock_gettime(CLOCK_MONOTONIC, &t0); + gendata("H48", argc > 1 ? argv[1] : "4", buf); + clock_gettime(CLOCK_MONOTONIC, &t1); + + if ((f = fopen("tables/data/h48_test", "wb")) == NULL) { + printf("Could not open file!\n"); + return 1; + } + fwrite(buf, SIZE_H1, 1, f); + + s = t1.tv_sec - t0.tv_sec + (t1.tv_nsec - t0.tv_nsec) / 1000000000.0; + printf("Data generated in %lfs\n", s); + + return 0; +} -- cgit v1.3