diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2024-07-03 15:05:10 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2024-07-03 15:05:10 +0200 |
| commit | 4a16da26dacdb37b9ef8d3d11e10ecb94b0cf396 (patch) | |
| tree | 64723639df2a44c94deb26276c5793101d3b6c41 /tools/benchmark_gendata_h48 | |
| parent | 3c9efb490ccbe1b0d7768d77fcdcac012c00e8c6 (diff) | |
| download | nissy-core-4a16da26dacdb37b9ef8d3d11e10ecb94b0cf396.tar.gz nissy-core-4a16da26dacdb37b9ef8d3d11e10ecb94b0cf396.zip | |
renamed benchmarks to tools
Diffstat (limited to 'tools/benchmark_gendata_h48')
| -rw-r--r-- | tools/benchmark_gendata_h48/benchmark_gendata_h48.c | 47 |
1 files changed, 47 insertions, 0 deletions
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 @@ | |||
| 1 | #include "../timerun.h" | ||
| 2 | #include "../../src/cube.h" | ||
| 3 | |||
| 4 | #define MAXDEPTH 10 | ||
| 5 | #define HVALUE 2 | ||
| 6 | #define OPTIONS "2;10" | ||
| 7 | #define LONGOPTIONS "h = 2, max depth = 10" | ||
| 8 | |||
| 9 | #define COCSEPSIZE 1119792 | ||
| 10 | #define ETABLESIZE(h) (((3393 * 495 * 70) >> 1) << (size_t)(h)) | ||
| 11 | |||
| 12 | char *buf; | ||
| 13 | |||
| 14 | void run(void) { | ||
| 15 | uint32_t *h48info; | ||
| 16 | int i; | ||
| 17 | int64_t s; | ||
| 18 | |||
| 19 | s = nissy_gendata("H48", OPTIONS, buf); | ||
| 20 | |||
| 21 | if (s == -1) { | ||
| 22 | printf("Error generating table\n"); | ||
| 23 | } else { | ||
| 24 | printf("Succesfully generated %" PRId64 " bytes. Table:\n", s); | ||
| 25 | h48info = (uint32_t *)buf + (ETABLESIZE(HVALUE) + COCSEPSIZE) / 4; | ||
| 26 | for (i = 0; i < MAXDEPTH+1; i++) | ||
| 27 | printf("%d:\t%" PRIu32 "\n", i, h48info[i+1]); | ||
| 28 | } | ||
| 29 | } | ||
| 30 | |||
| 31 | int main() { | ||
| 32 | int64_t size; | ||
| 33 | |||
| 34 | size = nissy_datasize("H48", OPTIONS); | ||
| 35 | if (size == -1) { | ||
| 36 | printf("gendata_h48 benchmark: error in datasize\n"); | ||
| 37 | return 1; | ||
| 38 | } | ||
| 39 | |||
| 40 | buf = malloc(size); | ||
| 41 | |||
| 42 | timerun(run, "benchmark gendata_h48 " LONGOPTIONS); | ||
| 43 | |||
| 44 | free(buf); | ||
| 45 | |||
| 46 | return 0; | ||
| 47 | } | ||
