diff options
| author | Mattias Andrée <maandree@kth.se> | 2016-04-28 21:52:47 +0200 |
|---|---|---|
| committer | Mattias Andrée <maandree@kth.se> | 2016-04-28 21:52:47 +0200 |
| commit | 73b0d33bafadb839962d5d6fbd5c1a8a18a8c56c (patch) | |
| tree | a263e3e79ae58b13925fa57845b7d7b991b25dbd /bench/benchmark-func.c | |
| parent | Fix warnings (diff) | |
| download | libzahl-73b0d33bafadb839962d5d6fbd5c1a8a18a8c56c.tar.gz libzahl-73b0d33bafadb839962d5d6fbd5c1a8a18a8c56c.tar.bz2 libzahl-73b0d33bafadb839962d5d6fbd5c1a8a18a8c56c.tar.xz | |
Some documentation and cleanup for benchmark stuff
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
| -rw-r--r-- | bench/benchmark-func.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/bench/benchmark-func.c b/bench/benchmark-func.c index 1dc9272..3427993 100644 --- a/bench/benchmark-func.c +++ b/bench/benchmark-func.c @@ -3,6 +3,11 @@ #include <limits.h> +#if !defined(USE_MEDIAN) && !defined(USE_MID_7TH_AVERAGE) && !defined(USE_AVERAGE) && !defined(USE_LOWEST) +# define USE_MID_7TH_AVERAGE +#endif + + enum { HIGH_ONLY, HIGH_AND_LOW, @@ -27,18 +32,20 @@ struct function { #define M_MAX 200 + static char buf[1000]; static z_t temp, temp2; static unsigned long long int measurements[M_MAX]; -#if 1 + +#if defined(USE_MEDIAN) || defined(USE_MID_7TH_AVERAGE) static int measurementpcmp(const void *ap_, const void *bp_) { const unsigned long long int *ap = ap_, *bp = bp_; return *ap < *bp ? -1 : *ap > *bp; } -# if 0 +# if defined(USE_MEDIAN) static unsigned long long int gettime(size_t m) { @@ -47,7 +54,7 @@ gettime(size_t m) return measurements[m / 2]; return (measurements[m / 2] + measurements[m / 2 - 1]) / 2; } -# else +# else /* if defined(USE_MID_7TH_AVERAGE) */ static unsigned long long int gettime(size_t m) { @@ -61,7 +68,7 @@ gettime(size_t m) # undef X } # endif -#elif 0 +#elif defined(USE_AVERAGE) static unsigned long long int gettime(size_t m) { @@ -71,7 +78,7 @@ gettime(size_t m) tot += measurements[i]; return tot / m; } -#else +#else /* if defined(USE_LOWEST) */ static unsigned long long int gettime(size_t m) { @@ -84,6 +91,7 @@ gettime(size_t m) } #endif + #define FUNCTION_2D(NAME, INSTRUCTION, PREINSTRUCTION)\ static void\ NAME(z_t *as, z_t* bs, struct function *f)\ @@ -183,6 +191,7 @@ gettime(size_t m) zdivmod */ + #define X(FN, A, F1, F2) FUNCTION_2D(bench_##FN, F1, F2) LIST_2D_FUNCTIONS #undef X @@ -194,6 +203,7 @@ LIST_2D_FUNCTIONS {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} }; + static z_t * create_ints(size_t start, size_t end, int mode) { |
