diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2024-09-12 09:58:04 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2024-09-12 09:58:04 +0200 |
| commit | 76cc82994c1fbb969ec61d3aede6bd42fda09005 (patch) | |
| tree | 653723d48b48d5fc9be20181b1f6720f624176d5 /tools/002_gendata_h48h0k2 | |
| parent | 10b65003102675bd19c0e5174ff249be2a163bc7 (diff) | |
| download | nissy-core-76cc82994c1fbb969ec61d3aede6bd42fda09005.tar.gz nissy-core-76cc82994c1fbb969ec61d3aede6bd42fda09005.zip | |
Cleanup gendata tools
Diffstat (limited to 'tools/002_gendata_h48h0k2')
| -rw-r--r-- | tools/002_gendata_h48h0k2/gendata_h48h0k2.c | 38 |
1 files changed, 3 insertions, 35 deletions
diff --git a/tools/002_gendata_h48h0k2/gendata_h48h0k2.c b/tools/002_gendata_h48h0k2/gendata_h48h0k2.c index 271d339..14f99ee 100644 --- a/tools/002_gendata_h48h0k2/gendata_h48h0k2.c +++ b/tools/002_gendata_h48h0k2/gendata_h48h0k2.c | |||
| @@ -1,11 +1,6 @@ | |||
| 1 | #include "../tool.h" | 1 | #include "../tool.h" |
| 2 | 2 | ||
| 3 | #define MAXDEPTH 20 | 3 | uint64_t expected[21] = { |
| 4 | #define HVALUE 0 | ||
| 5 | #define OPTIONS "0;2;20" | ||
| 6 | #define LONGOPTIONS "h = 0, k = 2, max depth = 20" | ||
| 7 | |||
| 8 | uint32_t expected[21] = { | ||
| 9 | /* Base value is 8 */ | 4 | /* Base value is 8 */ |
| 10 | [0] = 5473562, | 5 | [0] = 5473562, |
| 11 | [1] = 34776317, | 6 | [1] = 34776317, |
| @@ -13,41 +8,14 @@ uint32_t expected[21] = { | |||
| 13 | [3] = 8750867, | 8 | [3] = 8750867, |
| 14 | }; | 9 | }; |
| 15 | 10 | ||
| 16 | char *buf; | ||
| 17 | |||
| 18 | void run(void) { | 11 | void run(void) { |
| 19 | int64_t s; | 12 | gendata_run("h48", "0;2;20", "tables/h48h0k2", expected); |
| 20 | |||
| 21 | s = nissy_gendata("h48", OPTIONS, buf); | ||
| 22 | |||
| 23 | if (s == -1) { | ||
| 24 | printf("Error generating table\n"); | ||
| 25 | } else { | ||
| 26 | nissy_datainfo(buf, write_stdout); | ||
| 27 | printf("\n"); | ||
| 28 | printf("Succesfully generated %" PRId64 " bytes. " | ||
| 29 | "See above for details on the tables.\n", s); | ||
| 30 | |||
| 31 | /* TODO: check that the table is correct */ | ||
| 32 | } | ||
| 33 | } | 13 | } |
| 34 | 14 | ||
| 35 | int main(void) { | 15 | int main(void) { |
| 36 | int64_t size; | ||
| 37 | |||
| 38 | nissy_setlogger(log_stderr); | 16 | nissy_setlogger(log_stderr); |
| 39 | 17 | ||
| 40 | size = nissy_datasize("h48", OPTIONS); | 18 | timerun(run, "benchmark gendata_h48 h = 0, k = 2"); |
| 41 | if (size == -1) { | ||
| 42 | printf("gendata_h48 benchmark: error in datasize\n"); | ||
| 43 | return 1; | ||
| 44 | } | ||
| 45 | |||
| 46 | buf = malloc(size); | ||
| 47 | |||
| 48 | timerun(run, "benchmark gendata_h48 " LONGOPTIONS); | ||
| 49 | |||
| 50 | free(buf); | ||
| 51 | 19 | ||
| 52 | return 0; | 20 | return 0; |
| 53 | } | 21 | } |
