summaryrefslogtreecommitdiff
path: root/benchmarks/main.c
diff options
context:
space:
mode:
authorJoshua Haberman <joshua@reverberate.org>2009-08-04 22:06:02 -0700
committerJoshua Haberman <joshua@reverberate.org>2009-08-04 22:06:02 -0700
commit306bc554c67c23ddd52e5ece0e3971214b2da4e7 (patch)
tree898406cd3264ee2d001d334cd2b81922cbd23330 /benchmarks/main.c
parent1733b582579927379bc04a5838add06b76ada427 (diff)
More work on benchmarks (performance tests).
Diffstat (limited to 'benchmarks/main.c')
-rw-r--r--benchmarks/main.c10
1 files changed, 8 insertions, 2 deletions
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 <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();
+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;
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback