diff options
Diffstat (limited to 'benchmark/00_gendata_h48')
| -rw-r--r-- | benchmark/00_gendata_h48/gendata_h48_benchmark.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/benchmark/00_gendata_h48/gendata_h48_benchmark.c b/benchmark/00_gendata_h48/gendata_h48_benchmark.c new file mode 100644 index 0000000..1dc7c57 --- /dev/null +++ b/benchmark/00_gendata_h48/gendata_h48_benchmark.c | |||
| @@ -0,0 +1,42 @@ | |||
| 1 | #include "../benchmark.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 | char *buf; | ||
| 10 | |||
| 11 | void run(void) { | ||
| 12 | uint32_t *buf32; | ||
| 13 | int i; | ||
| 14 | int64_t s; | ||
| 15 | |||
| 16 | s = nissy_gendata("H48", OPTIONS, buf); | ||
| 17 | |||
| 18 | if (s == -1) { | ||
| 19 | printf("Error generating table\n"); | ||
| 20 | } else { | ||
| 21 | printf("Succesfully generated %" PRId64 " bytes. Table:\n", s); | ||
| 22 | buf32 = (uint32_t *)&buf[s-sizeof(uint32_t)*(MAXDEPTH+1)]; | ||
| 23 | for (i = 0; i <= MAXDEPTH; i++) | ||
| 24 | printf("%d:\t%" PRId32 "\n", i, buf32[i]); | ||
| 25 | } | ||
| 26 | } | ||
| 27 | |||
| 28 | int main() { | ||
| 29 | int64_t size; | ||
| 30 | |||
| 31 | size = nissy_datasize("H48", OPTIONS); | ||
| 32 | if (size == -1) { | ||
| 33 | printf("gendata_h48 benchmark: error in datasize\n"); | ||
| 34 | return 1; | ||
| 35 | } | ||
| 36 | |||
| 37 | buf = malloc(size); | ||
| 38 | |||
| 39 | time_benchmark(run, "gendata_h48 " LONGOPTIONS); | ||
| 40 | |||
| 41 | return 0; | ||
| 42 | } | ||
