From 306bc554c67c23ddd52e5ece0e3971214b2da4e7 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Tue, 4 Aug 2009 22:06:02 -0700 Subject: More work on benchmarks (performance tests). --- benchmarks/main.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'benchmarks/main.c') diff --git a/benchmarks/main.c b/benchmarks/main.c index f66b4d0..df8298f 100644 --- a/benchmarks/main.c +++ b/benchmarks/main.c @@ -5,9 +5,15 @@ #include #include +/* 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(); +static size_t run(int i); int main (int argc, char *argv[]) { @@ -32,7 +38,7 @@ int main (int argc, char *argv[]) clock_t before = clock(); for(int i = 0; true; i++) { if((i & 0xFF) == 0 && (clock() - before > CLOCKS_PER_SEC)) break; - size_t bytes = run(); + size_t bytes = run(i); if(bytes == 0) { fprintf(stderr, "%s: failed.\n", argv[0]); return 2; -- cgit v1.2.3