Commit 3439a6a2 authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul

Quiet down some of the newbrt tests. Addresses #13.

git-svn-id: file:///svn/tokudb@1330 c7de825b-a66e-492c-adef-691d508d4ae1
parent f6688f5b
# On cygwin do: # On cygwin do:
# make CYGWIN=cygwin check # make CYGWIN=cygwin check
# For verbose output do
# make VERBOSE=1
# For very verbose output do
# make VERBOSE=2
# GCOV_FLAGS = -fprofile-arcs -ftest-coverage # GCOV_FLAGS = -fprofile-arcs -ftest-coverage
# PROF_FLAGS = -pg # PROF_FLAGS = -pg
OPTFLAGS = -O2 OPTFLAGS = -O2
ifeq ($(VERBOSE),2)
VERBVERBOSE=-v
MAYBEATSIGN=
else
ifeq ($(VERBOSE),1)
VERBVERBOSE=-q
MAYBEATSIGN=
else
VERBVERBOSE=-q
MAYBEATSIGN=@
endif
endif
ifeq ($(CYGWIN),cygwin) ifeq ($(CYGWIN),cygwin)
else else
FPICFLAGS = -fPIC FPICFLAGS = -fPIC
...@@ -71,10 +89,10 @@ CHECKS = \ ...@@ -71,10 +89,10 @@ CHECKS = \
test_toku_malloc_plain_free test_toku_malloc_plain_free
check: bins $(patsubst %,check_%,$(CHECKS)) check_benchmarktest_256 check: bins $(patsubst %,check_%,$(CHECKS)) check_benchmarktest_256
check_benchmarktest_256: benchmark-test check_benchmarktest_256: benchmark-test
$(DTOOL) ./benchmark-test --valsize 256 --verify 1 $(DTOOL) ./benchmark-test $(VERBVERBOSE) --valsize 256 --verify 1
check_%: % check_%: %
$(DTOOL) ./$< $(DTOOL) ./$< $(VERBVERBOSE)
check-fanout: check-fanout:
let BRT_FANOUT=4; \ let BRT_FANOUT=4; \
......
...@@ -26,6 +26,7 @@ static int keysize = sizeof (long long); ...@@ -26,6 +26,7 @@ static int keysize = sizeof (long long);
static int valsize = sizeof (long long); static int valsize = sizeof (long long);
static int do_verify =0; /* Do a slow verify after every insert. */ static int do_verify =0; /* Do a slow verify after every insert. */
static int verbose = 1;
static CACHETABLE ct; static CACHETABLE ct;
static BRT t; static BRT t;
...@@ -90,18 +91,22 @@ static void biginsert (long long n_elements, struct timeval *starttime) { ...@@ -90,18 +91,22 @@ static void biginsert (long long n_elements, struct timeval *starttime) {
gettimeofday(&t1,0); gettimeofday(&t1,0);
serial_insert_from(i); serial_insert_from(i);
gettimeofday(&t2,0); gettimeofday(&t2,0);
if (verbose) {
printf("serial %9.6fs %8.0f/s ", tdiff(&t2, &t1), ITEMS_TO_INSERT_PER_ITERATION/tdiff(&t2, &t1)); printf("serial %9.6fs %8.0f/s ", tdiff(&t2, &t1), ITEMS_TO_INSERT_PER_ITERATION/tdiff(&t2, &t1));
fflush(stdout); fflush(stdout);
}
gettimeofday(&t1,0); gettimeofday(&t1,0);
random_insert_below((i+ITEMS_TO_INSERT_PER_ITERATION)*SERIAL_SPACING); random_insert_below((i+ITEMS_TO_INSERT_PER_ITERATION)*SERIAL_SPACING);
gettimeofday(&t2,0); gettimeofday(&t2,0);
if (verbose) {
printf("random %9.6fs %8.0f/s ", tdiff(&t2, &t1), ITEMS_TO_INSERT_PER_ITERATION/tdiff(&t2, &t1)); printf("random %9.6fs %8.0f/s ", tdiff(&t2, &t1), ITEMS_TO_INSERT_PER_ITERATION/tdiff(&t2, &t1));
printf("cumulative %9.6fs %8.0f/s\n", tdiff(&t2, starttime), (ITEMS_TO_INSERT_PER_ITERATION*2.0/tdiff(&t2, starttime))*(iteration+1)); printf("cumulative %9.6fs %8.0f/s\n", tdiff(&t2, starttime), (ITEMS_TO_INSERT_PER_ITERATION*2.0/tdiff(&t2, starttime))*(iteration+1));
} }
}
} }
static void usage() { static void usage() {
printf("benchmark-test [--nodesize NODESIZE] [--keysize KEYSIZE] [--valsize VALSIZE] [--verify] [TOTALITEMS]\n"); printf("benchmark-test [-v] [--nodesize NODESIZE] [--keysize KEYSIZE] [--valsize VALSIZE] [--verify] [TOTALITEMS]\n");
} }
int main (int argc, char *argv[]) { int main (int argc, char *argv[]) {
...@@ -116,33 +121,27 @@ int main (int argc, char *argv[]) { ...@@ -116,33 +121,27 @@ int main (int argc, char *argv[]) {
i++; i++;
nodesize = atoi(argv[i]); nodesize = atoi(argv[i]);
} }
continue; } else if (strcmp(arg, "--keysize") == 0) {
}
if (strcmp(arg, "--keysize") == 0) {
if (i+1 < argc) { if (i+1 < argc) {
i++; i++;
keysize = atoi(argv[i]); keysize = atoi(argv[i]);
} }
continue; } else if (strcmp(arg, "--valsize") == 0) {
}
if (strcmp(arg, "--valsize") == 0) {
if (i+1 < argc) { if (i+1 < argc) {
i++; i++;
valsize = atoi(argv[i]); valsize = atoi(argv[i]);
} }
continue; } else if (strcmp(arg, "--verify")==0) {
}
if (strcmp(arg, "--verify")==0) {
do_verify = 1; do_verify = 1;
continue; } else if (strcmp(arg, "-v")==0) {
} verbose = 1;
} else if (strcmp(arg, "-q")==0) {
verbose = 0;
} else {
usage(); usage();
return 1; return 1;
} }
}
struct timeval t1,t2,t3; struct timeval t1,t2,t3;
long long total_n_items; long long total_n_items;
...@@ -157,19 +156,25 @@ int main (int argc, char *argv[]) { ...@@ -157,19 +156,25 @@ int main (int argc, char *argv[]) {
total_n_items = 1LL<<22; // 1LL<<16 total_n_items = 1LL<<22; // 1LL<<16
} }
if (verbose) {
printf("nodesize=%d\n", nodesize); printf("nodesize=%d\n", nodesize);
printf("keysize=%d\n", keysize); printf("keysize=%d\n", keysize);
printf("valsize=%d\n", valsize); printf("valsize=%d\n", valsize);
printf("Serial and random insertions of %d per batch\n", ITEMS_TO_INSERT_PER_ITERATION); printf("Serial and random insertions of %d per batch\n", ITEMS_TO_INSERT_PER_ITERATION);
}
setup(); setup();
gettimeofday(&t1,0); gettimeofday(&t1,0);
biginsert(total_n_items, &t1); biginsert(total_n_items, &t1);
gettimeofday(&t2,0); gettimeofday(&t2,0);
shutdown(); shutdown();
gettimeofday(&t3,0); gettimeofday(&t3,0);
if (verbose) {
printf("Shutdown %9.6fs\n", tdiff(&t3, &t2)); 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), 2*total_n_items, 2*total_n_items/tdiff(&t3, &t1));
}
if (verbose) {
toku_malloc_report(); toku_malloc_report();
}
toku_malloc_cleanup(); toku_malloc_cleanup();
return 0; return 0;
} }
......
This diff is collapsed.
...@@ -1454,7 +1454,7 @@ static int setup_brt_root_node (BRT t, DISKOFF offset, TOKUTXN txn) { ...@@ -1454,7 +1454,7 @@ static int setup_brt_root_node (BRT t, DISKOFF offset, TOKUTXN txn) {
toku_log_newbrtnode(txn, toku_txn_get_txnid(txn), toku_cachefile_filenum(t->cf), offset, 0, t->h->nodesize, (t->flags&TOKU_DB_DUPSORT)!=0, node->rand4fingerprint); toku_log_newbrtnode(txn, toku_txn_get_txnid(txn), toku_cachefile_filenum(t->cf), offset, 0, t->h->nodesize, (t->flags&TOKU_DB_DUPSORT)!=0, node->rand4fingerprint);
if (txn) { if (txn) {
node->log_lsn = toku_txn_get_last_lsn(txn); node->log_lsn = toku_txn_get_last_lsn(txn);
fprintf(stderr, "%s:%d last lsn=%" PRId64 "\n", __FILE__, __LINE__, node->log_lsn.lsn); //fprintf(stderr, "%s:%d last lsn=%" PRId64 "\n", __FILE__, __LINE__, node->log_lsn.lsn);
} }
r=toku_cachetable_unpin(t->cf, node->thisnodename, node->dirty, brtnode_size(node)); r=toku_cachetable_unpin(t->cf, node->thisnodename, node->dirty, brtnode_size(node));
if (r!=0) { if (r!=0) {
......
...@@ -8,6 +8,9 @@ ...@@ -8,6 +8,9 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <string.h>
#include "test.h"
static const int test_object_size = 1; static const int test_object_size = 1;
...@@ -167,9 +170,15 @@ static void test_chaining (void) { ...@@ -167,9 +170,15 @@ static void test_chaining (void) {
r = toku_cachetable_close(&ct); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0);
} }
int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__unused__))) { void usage (const char *progname) {
fprintf(stderr, "Usage:\n %s [-v] [-q]\n", progname);
exit(1);
}
int main (int argc, const char *argv[]) {
default_parse_args(argc, argv);
test_chaining(); test_chaining();
toku_malloc_cleanup(); toku_malloc_cleanup();
printf("ok\n"); if (verbose) printf("ok\n");
return 0; return 0;
} }
...@@ -603,7 +603,7 @@ int toku_read_and_print_logmagic (FILE *f, u_int32_t *versionp) { ...@@ -603,7 +603,7 @@ int toku_read_and_print_logmagic (FILE *f, u_int32_t *versionp) {
if (r!=4) { if (r!=4) {
return DB_BADFORMAT; return DB_BADFORMAT;
} }
printf("tokulog v.%d\n", ntohl(version)); //printf("tokulog v.%d\n", ntohl(version));
*versionp=ntohl(version); *versionp=ntohl(version);
} }
return 0; return 0;
......
...@@ -228,7 +228,7 @@ int main (int argc, char *argv[]) { ...@@ -228,7 +228,7 @@ int main (int argc, char *argv[]) {
int i; int i;
r = toku_create_cachetable(&ct, 1<<25, (LSN){0}, 0); r = toku_create_cachetable(&ct, 1<<25, (LSN){0}, 0);
for (i=0; i<n_logfiles; i++) { for (i=0; i<n_logfiles; i++) {
fprintf(stderr, "Opening %s\n", logfiles[i]); //fprintf(stderr, "Opening %s\n", logfiles[i]);
FILE *f = fopen(logfiles[i], "r"); FILE *f = fopen(logfiles[i], "r");
struct log_entry le; struct log_entry le;
u_int32_t version; u_int32_t version;
......
int verbose=0;
void default_parse_args (int argc, const char *argv[]) {
const char *progname=argv[0];
argc--; argv++;
while (argc>0) {
if (strcmp(argv[0],"-v")==0) {
verbose=1;
} else if (strcmp(argv[0],"-q")==0) {
verbose=0;
} else {
fprintf(stderr, "Usage:\n %s [-v] [-q]\n", progname);
exit(1);
}
argc--; argv++;
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment