diff options
author | Josh Haberman <jhaberman@gmail.com> | 2014-12-09 16:01:56 -0800 |
---|---|---|
committer | Josh Haberman <jhaberman@gmail.com> | 2014-12-09 16:01:56 -0800 |
commit | 56913be6bb57f81dbbf7baf9cc9a0a2cd1a36493 (patch) | |
tree | f4d1c17aef4e5d01578ba3fd3926ca863e2792f2 /benchmarks/main.c | |
parent | 82be433d4188e0b3b992e463ad52ee148d3ad8de (diff) |
Removed obsolete benchmarks/ and examples/ directories.
Diffstat (limited to 'benchmarks/main.c')
-rw-r--r-- | benchmarks/main.c | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/benchmarks/main.c b/benchmarks/main.c deleted file mode 100644 index 3d98a05..0000000 --- a/benchmarks/main.c +++ /dev/null @@ -1,55 +0,0 @@ - -#include <stdbool.h> -#include <time.h> -#include <stdio.h> -#include <unistd.h> -#include <string.h> - -/* Cycle between a bunch of different messages, to avoid performance - * variations due to memory effects of a particular allocation pattern. */ -#ifndef NUM_MESSAGES -#define NUM_MESSAGES 32 -#endif - -static bool initialize(); -static void cleanup(); -static size_t run(int i); - -int main (int argc, char *argv[]) -{ - (void)argc; - - /* Change cwd to where the binary is. */ - char *lastslash = strrchr(argv[0], '/'); - char *progname = argv[0]; - if(lastslash) { - *lastslash = '\0'; - if(chdir(argv[0]) < 0) { - fprintf(stderr, "Error changing directory to %s.\n", argv[0]); - return 1; - } - *lastslash = '/'; - progname = lastslash + 3; /* "/b_" */ - } - - 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(i); - 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", progname, (int)(total_bytes / elapsed / (1 << 20))); - cleanup(); - return 0; -} |