From 32ae76dc9ca683cf73c66903248df3744918667b Mon Sep 17 00:00:00 2001 From: Rich Prohaska Date: Sat, 1 Mar 2008 15:32:38 +0000 Subject: [PATCH] add --norandom git-svn-id: file:///svn/tokudb@2483 c7de825b-a66e-492c-adef-691d508d4ae1 --- db-benchmark-test/db-benchmark-test.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/db-benchmark-test/db-benchmark-test.c b/db-benchmark-test/db-benchmark-test.c index 34d8e588ec5..a8741b0982c 100644 --- a/db-benchmark-test/db-benchmark-test.c +++ b/db-benchmark-test/db-benchmark-test.c @@ -29,6 +29,7 @@ int pagesize = 0; long long cachesize = 128*1024*1024; int dupflags = 0; int noserial = 0; // Don't do the serial stuff +int norandom = 0; // Don't do the random stuff int items_per_transaction = DEFAULT_ITEMS_PER_TRANSACTION; int items_per_iteration = DEFAULT_ITEMS_TO_INSERT_PER_ITERATION; @@ -201,11 +202,13 @@ void biginsert (long long n_elements, struct timeval *starttime) { printf("serial %9.6fs %8.0f/s ", tdiff(&t2, &t1), items_per_iteration/tdiff(&t2, &t1)); fflush(stdout); } + if (!norandom) { gettimeofday(&t1,0); random_insert_below((i+items_per_iteration)*SERIAL_SPACING); gettimeofday(&t2,0); printf("random %9.6fs %8.0f/s ", tdiff(&t2, &t1), items_per_iteration/tdiff(&t2, &t1)); - printf("cumulative %9.6fs %8.0f/s\n", tdiff(&t2, starttime), (items_per_iteration*2.0/tdiff(&t2, starttime))*(iteration+1)); + } + printf("cumulative %9.6fs %8.0f/s\n", tdiff(&t2, starttime), (((float)items_per_iteration*(!noserial+!norandom))/tdiff(&t2, starttime))*(iteration+1)); } } @@ -246,6 +249,10 @@ int main (int argc, const char *argv[]) { noserial=1; continue; } + if (strcmp(arg, "--norandom") == 0) { + norandom=1; + continue; + } if (strcmp(arg, "--xcount") == 0) { if (i+1 >= argc) return print_usage(argv[0]); items_per_transaction = strtoll(argv[++i], 0, 10); @@ -293,8 +300,10 @@ int main (int argc, const char *argv[]) { } total_n_items = items_per_iteration * (long long)n_iterations; } - if (!noserial) printf("serial and "); - printf("random insertions of %d per batch%s\n", items_per_iteration, do_transactions ? " (with transactions)" : ""); + if (!noserial) printf("serial "); + if (!noserial && !norandom) printf("and "); + if (!norandom) printf("random "); + printf("insertions of %d per batch%s\n", items_per_iteration, do_transactions ? " (with transactions)" : ""); setup(); gettimeofday(&t1,0); biginsert(total_n_items, &t1); @@ -302,7 +311,8 @@ int main (int argc, const char *argv[]) { shutdown(); gettimeofday(&t3,0); printf("Shutdown %9.6fs\n", tdiff(&t3, &t2)); - printf("Total time %9.6fs for %lld insertions = %8.0f/s\n", tdiff(&t3, &t1), 2*total_n_items, 2*total_n_items/tdiff(&t3, &t1)); + printf("Total time %9.6fs for %lld insertions = %8.0f/s\n", tdiff(&t3, &t1), + (!noserial+!norandom)*total_n_items, (!noserial+!norandom)*total_n_items/tdiff(&t3, &t1)); return 0; }