From 4a16da26dacdb37b9ef8d3d11e10ecb94b0cf396 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Wed, 3 Jul 2024 15:05:10 +0200 Subject: renamed benchmarks to tools --- .../benchmark_gendata_h48/benchmark_gendata_h48.c | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 tools/benchmark_gendata_h48/benchmark_gendata_h48.c (limited to 'tools/benchmark_gendata_h48') diff --git a/tools/benchmark_gendata_h48/benchmark_gendata_h48.c b/tools/benchmark_gendata_h48/benchmark_gendata_h48.c new file mode 100644 index 0000000..efb6f6f --- /dev/null +++ b/tools/benchmark_gendata_h48/benchmark_gendata_h48.c @@ -0,0 +1,47 @@ +#include "../timerun.h" +#include "../../src/cube.h" + +#define MAXDEPTH 10 +#define HVALUE 2 +#define OPTIONS "2;10" +#define LONGOPTIONS "h = 2, max depth = 10" + +#define COCSEPSIZE 1119792 +#define ETABLESIZE(h) (((3393 * 495 * 70) >> 1) << (size_t)(h)) + +char *buf; + +void run(void) { + uint32_t *h48info; + int i; + int64_t s; + + s = nissy_gendata("H48", OPTIONS, buf); + + if (s == -1) { + printf("Error generating table\n"); + } else { + printf("Succesfully generated %" PRId64 " bytes. Table:\n", s); + h48info = (uint32_t *)buf + (ETABLESIZE(HVALUE) + COCSEPSIZE) / 4; + for (i = 0; i < MAXDEPTH+1; i++) + printf("%d:\t%" PRIu32 "\n", i, h48info[i+1]); + } +} + +int main() { + int64_t size; + + size = nissy_datasize("H48", OPTIONS); + if (size == -1) { + printf("gendata_h48 benchmark: error in datasize\n"); + return 1; + } + + buf = malloc(size); + + timerun(run, "benchmark gendata_h48 " LONGOPTIONS); + + free(buf); + + return 0; +} -- cgit v1.3