aboutsummaryrefslogtreecommitdiff
path: root/tables/tables.c
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2024-05-24 22:20:00 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2024-05-24 22:20:00 +0200
commit8954b4b7eaafa8e306f2aa6cbb7e32334107e6e1 (patch)
tree6fc56f9ba2588d7c3c2d5f6d99b3343e1aaf8a34 /tables/tables.c
parent8145e034184ed5807c00f05b90101090c6513a29 (diff)
downloadnissy-core-8954b4b7eaafa8e306f2aa6cbb7e32334107e6e1.tar.gz
nissy-core-8954b4b7eaafa8e306f2aa6cbb7e32334107e6e1.zip
Added table generation utility
Diffstat (limited to '')
-rw-r--r--tables/tables.c34
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
13char buf[SIZE_H1];
14
15int 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}

Generated with cgit - Back to sebastiano.tronto.net