aboutsummaryrefslogtreecommitdiff
path: root/tools/000_gendata/gendata.c
diff options
context:
space:
mode:
authorenricotenuti <tenutz_27@outlook.it>2024-09-29 12:42:31 +0200
committerenricotenuti <tenutz_27@outlook.it>2024-09-29 12:42:31 +0200
commit7a52b4cd50a40e4bce919b6bd51203d0e9867141 (patch)
tree95ab133f9771c4791d5c784f1b3d4822b1dd7d3c /tools/000_gendata/gendata.c
parent8fcfb3a33fe053ed2032d58ecc0b5d640c155931 (diff)
parent774a824a6c80b5af495f4fb99d98758e3b9f6b81 (diff)
downloadnissy-core-7a52b4cd50a40e4bce919b6bd51203d0e9867141.tar.gz
nissy-core-7a52b4cd50a40e4bce919b6bd51203d0e9867141.zip
Merge remote-tracking branch 'upstream/master'
Merge upstream
Diffstat (limited to 'tools/000_gendata/gendata.c')
-rw-r--r--tools/000_gendata/gendata.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/tools/000_gendata/gendata.c b/tools/000_gendata/gendata.c
new file mode 100644
index 0000000..90166dd
--- /dev/null
+++ b/tools/000_gendata/gendata.c
@@ -0,0 +1,55 @@
1#include "../tool.h"
2#include "../expected_distributions.h"
3
4char *solver, *options;
5uint64_t *expected;
6
7static void
8run(void) {
9 int64_t size;
10 char *buf, filename[1024];
11
12 getfilename(solver, options, filename);
13 size = generatetable(solver, options, &buf);
14 switch (size) {
15 case -1:
16 return;
17 case -2:
18 goto gendata_run_finish;
19 default:
20 nissy_datainfo(buf, write_stdout);
21 printf("\n");
22 printf("Succesfully generated %" PRId64 " bytes. "
23 "See above for details on the tables.\n", size);
24
25 writetable(buf, size, filename);
26 break;
27 }
28
29gendata_run_finish:
30 free(buf);
31}
32
33int main(int argc, char **argv) {
34 uint8_t h, k;
35 char description[256];
36
37 if (argc < 3) {
38 fprintf(stderr, "Error: not enough arguments. "
39 "A solver and its options must be given.\n");
40 return 1;
41 }
42
43 solver = argv[1];
44 options = argv[2];
45 parse_h48_options(options, &h, &k, NULL);
46 expected = expected_h48[h][k];
47 sprintf(description, "benchmark gendata_h48 h = %" PRIu8
48 ", k = %" PRIu8 "", h, k);
49
50 nissy_setlogger(log_stderr);
51
52 timerun(run, description);
53
54 return 0;
55}

Generated with cgit - Back to sebastiano.tronto.net