diff options
author | Joshua Haberman <joshua@reverberate.org> | 2009-08-04 19:46:42 -0700 |
---|---|---|
committer | Joshua Haberman <joshua@reverberate.org> | 2009-08-04 19:46:42 -0700 |
commit | 84cd1538ee20b934c6892f38578a08106a934fe8 (patch) | |
tree | ecfc5baa4d47a276bf1509243778ae7940e08e83 /benchmark/main.c | |
parent | 2aaea5390a841e2682a318746e90aebbe8a955b9 (diff) |
Integrated benchmarks into main Makefile.
Diffstat (limited to 'benchmark/main.c')
-rw-r--r-- | benchmark/main.c | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/benchmark/main.c b/benchmark/main.c deleted file mode 100644 index c038287..0000000 --- a/benchmark/main.c +++ /dev/null @@ -1,32 +0,0 @@ - -#include <stdbool.h> -#include <time.h> -#include <stdio.h> - -static bool initialize(); -static void cleanup(); -static size_t run(); - -int main (int argc, char *argv[]) -{ - if(!initialize()) { - fprintf(stderr, "%s: failed to initialize\n", argv[0]); - return 1; - } - - size_t total_bytes = 0; - clock_t before = clock(); - for(int i = 0; true; i++) { - if((i & 0xFF) == 0 && (clock() - before > CLOCKS_PER_SEC)) break; - size_t bytes = run(); - if(bytes == 0) { - fprintf(stderr, "%s: failed.\n", argv[0]); - return 2; - } - total_bytes += bytes; - } - double elapsed = ((double)clock() - before) / CLOCKS_PER_SEC; - printf("%s: %d\n", argv[0], (int)(total_bytes / elapsed / (1 << 20))); - cleanup(); - return 0; -} |