Commit ecbaab27 authored by Yoni Fogel's avatar Yoni Fogel

Addresses #1463 Modified benchmark-test to check for more errors

git-svn-id: file:///svn/toku/tokudb@9350 c7de825b-a66e-492c-adef-691d508d4ae1
parent d07bf47f
...@@ -51,7 +51,8 @@ static void insert (long long v) { ...@@ -51,7 +51,8 @@ static void insert (long long v) {
long_long_to_array(kc, v); long_long_to_array(kc, v);
memset(vc, 0, sizeof vc); memset(vc, 0, sizeof vc);
long_long_to_array(vc, v); long_long_to_array(vc, v);
toku_brt_insert(t, toku_fill_dbt(&kt, kc, keysize), toku_fill_dbt(&vt, vc, valsize), 0); int r = toku_brt_insert(t, toku_fill_dbt(&kt, kc, keysize), toku_fill_dbt(&vt, vc, valsize), 0);
CKERR(r);
if (do_verify) toku_cachetable_verify(ct); if (do_verify) toku_cachetable_verify(ct);
} }
...@@ -97,12 +98,14 @@ static void biginsert (long long n_elements, struct timeval *starttime) { ...@@ -97,12 +98,14 @@ static void biginsert (long long n_elements, struct timeval *starttime) {
gettimeofday(&t2,0); gettimeofday(&t2,0);
if (verbose && do_random) { if (verbose && do_random) {
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));
fflush(stdout);
} }
if (verbose && (do_serial || do_random)) { if (verbose && (do_serial || do_random)) {
double f = 0; double f = 0;
if (do_serial) f += 1.0; if (do_serial) f += 1.0;
if (do_random) f += 1.0; if (do_random) f += 1.0;
printf("cumulative %9.6fs %8.0f/s\n", tdiff(&t2, starttime), (ITEMS_TO_INSERT_PER_ITERATION*f/tdiff(&t2, starttime))*(iteration+1)); printf("cumulative %9.6fs %8.0f/s\n", tdiff(&t2, starttime), (ITEMS_TO_INSERT_PER_ITERATION*f/tdiff(&t2, starttime))*(iteration+1));
fflush(stdout);
} }
} }
} }
...@@ -177,6 +180,7 @@ test_main (int argc, const char *argv[]) { ...@@ -177,6 +180,7 @@ test_main (int argc, const char *argv[]) {
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);
fflush(stdout);
} }
setup(); setup();
gettimeofday(&t1,0); gettimeofday(&t1,0);
...@@ -190,6 +194,7 @@ test_main (int argc, const char *argv[]) { ...@@ -190,6 +194,7 @@ test_main (int argc, const char *argv[]) {
if (do_random) f += 1; if (do_random) f += 1;
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), f*total_n_items, f*total_n_items/tdiff(&t3, &t1)); printf("Total time %9.6fs for %lld insertions = %8.0f/s\n", tdiff(&t3, &t1), f*total_n_items, f*total_n_items/tdiff(&t3, &t1));
fflush(stdout);
} }
if (verbose>1) { if (verbose>1) {
toku_malloc_report(); toku_malloc_report();
......
...@@ -17,12 +17,6 @@ typedef void *OMTVALUE; ...@@ -17,12 +17,6 @@ typedef void *OMTVALUE;
typedef OMTVALUE TESTVALUE; typedef OMTVALUE TESTVALUE;
/* Things that would go in a omt-tests.h if we split to multiple files later. */
#define CKERR(r) do { if (r!=0) fprintf(stderr, "%s:%d error %d %s\n", __FILE__, __LINE__, r, strerror(r)); assert(r==0); } while (0)
#define CKERR2(r,r2) do { if (r!=r2) fprintf(stderr, "%s:%d error %d %s, expected %d\n", __FILE__, __LINE__, r, strerror(r), r2); assert(r==r2); } while (0)
#define CKERR2s(r,r2,r3) do { if (r!=r2 && r!=r3) fprintf(stderr, "%s:%d error %d %s, expected %d or %d\n", __FILE__, __LINE__, r, strerror(r), r2,r3); assert(r==r2||r==r3); } while (0)
static void static void
parse_args (int argc, const char *argv[]) { parse_args (int argc, const char *argv[]) {
const char *argv0=argv[0]; const char *argv0=argv[0];
......
...@@ -5,6 +5,10 @@ ...@@ -5,6 +5,10 @@
#include "toku_portability.h" #include "toku_portability.h"
#include "brt.h" #include "brt.h"
#define CKERR(r) do { if (r!=0) fprintf(stderr, "%s:%d error %d %s\n", __FILE__, __LINE__, r, strerror(r)); assert(r==0); } while (0)
#define CKERR2(r,r2) do { if (r!=r2) fprintf(stderr, "%s:%d error %d %s, expected %d\n", __FILE__, __LINE__, r, strerror(r), r2); assert(r==r2); } while (0)
#define CKERR2s(r,r2,r3) do { if (r!=r2 && r!=r3) fprintf(stderr, "%s:%d error %d %s, expected %d or %d\n", __FILE__, __LINE__, r, strerror(r), r2,r3); assert(r==r2||r==r3); } while (0)
int verbose=0; int verbose=0;
void void
......
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