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:
# 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
# PROF_FLAGS = -pg
OPTFLAGS = -O2
ifeq ($(VERBOSE),2)
VERBVERBOSE=-v
MAYBEATSIGN=
else
ifeq ($(VERBOSE),1)
VERBVERBOSE=-q
MAYBEATSIGN=
else
VERBVERBOSE=-q
MAYBEATSIGN=@
endif
endif
ifeq ($(CYGWIN),cygwin)
else
FPICFLAGS = -fPIC
......@@ -71,10 +89,10 @@ CHECKS = \
test_toku_malloc_plain_free
check: bins $(patsubst %,check_%,$(CHECKS)) check_benchmarktest_256
check_benchmarktest_256: benchmark-test
$(DTOOL) ./benchmark-test --valsize 256 --verify 1
$(DTOOL) ./benchmark-test $(VERBVERBOSE) --valsize 256 --verify 1
check_%: %
$(DTOOL) ./$<
$(DTOOL) ./$< $(VERBVERBOSE)
check-fanout:
let BRT_FANOUT=4; \
......
......@@ -26,6 +26,7 @@ static int keysize = sizeof (long long);
static int valsize = sizeof (long long);
static int do_verify =0; /* Do a slow verify after every insert. */
static int verbose = 1;
static CACHETABLE ct;
static BRT t;
......@@ -90,18 +91,22 @@ static void biginsert (long long n_elements, struct timeval *starttime) {
gettimeofday(&t1,0);
serial_insert_from(i);
gettimeofday(&t2,0);
printf("serial %9.6fs %8.0f/s ", tdiff(&t2, &t1), ITEMS_TO_INSERT_PER_ITERATION/tdiff(&t2, &t1));
fflush(stdout);
if (verbose) {
printf("serial %9.6fs %8.0f/s ", tdiff(&t2, &t1), ITEMS_TO_INSERT_PER_ITERATION/tdiff(&t2, &t1));
fflush(stdout);
}
gettimeofday(&t1,0);
random_insert_below((i+ITEMS_TO_INSERT_PER_ITERATION)*SERIAL_SPACING);
gettimeofday(&t2,0);
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));
if (verbose) {
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));
}
}
}
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[]) {
......@@ -116,32 +121,26 @@ int main (int argc, char *argv[]) {
i++;
nodesize = atoi(argv[i]);
}
continue;
}
if (strcmp(arg, "--keysize") == 0) {
} else if (strcmp(arg, "--keysize") == 0) {
if (i+1 < argc) {
i++;
keysize = atoi(argv[i]);
}
continue;
}
if (strcmp(arg, "--valsize") == 0) {
} else if (strcmp(arg, "--valsize") == 0) {
if (i+1 < argc) {
i++;
valsize = atoi(argv[i]);
}
continue;
}
if (strcmp(arg, "--verify")==0) {
} else if (strcmp(arg, "--verify")==0) {
do_verify = 1;
continue;
} else if (strcmp(arg, "-v")==0) {
verbose = 1;
} else if (strcmp(arg, "-q")==0) {
verbose = 0;
} else {
usage();
return 1;
}
usage();
return 1;
}
struct timeval t1,t2,t3;
......@@ -157,19 +156,25 @@ int main (int argc, char *argv[]) {
total_n_items = 1LL<<22; // 1LL<<16
}
printf("nodesize=%d\n", nodesize);
printf("keysize=%d\n", keysize);
printf("valsize=%d\n", valsize);
printf("Serial and random insertions of %d per batch\n", ITEMS_TO_INSERT_PER_ITERATION);
if (verbose) {
printf("nodesize=%d\n", nodesize);
printf("keysize=%d\n", keysize);
printf("valsize=%d\n", valsize);
printf("Serial and random insertions of %d per batch\n", ITEMS_TO_INSERT_PER_ITERATION);
}
setup();
gettimeofday(&t1,0);
biginsert(total_n_items, &t1);
gettimeofday(&t2,0);
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));
toku_malloc_report();
if (verbose) {
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));
}
if (verbose) {
toku_malloc_report();
}
toku_malloc_cleanup();
return 0;
}
......
This diff is collapsed.
......@@ -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);
if (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));
if (r!=0) {
......
......@@ -8,6 +8,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include "test.h"
static const int test_object_size = 1;
......@@ -167,9 +170,15 @@ static void test_chaining (void) {
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();
toku_malloc_cleanup();
printf("ok\n");
if (verbose) printf("ok\n");
return 0;
}
......@@ -603,7 +603,7 @@ int toku_read_and_print_logmagic (FILE *f, u_int32_t *versionp) {
if (r!=4) {
return DB_BADFORMAT;
}
printf("tokulog v.%d\n", ntohl(version));
//printf("tokulog v.%d\n", ntohl(version));
*versionp=ntohl(version);
}
return 0;
......
......@@ -228,7 +228,7 @@ int main (int argc, char *argv[]) {
int i;
r = toku_create_cachetable(&ct, 1<<25, (LSN){0}, 0);
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");
struct log_entry le;
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