Commit 870b7d6b authored by Barry Perlman's avatar Barry Perlman Committed by Yoni Fogel

[t:4136] #4136 Add engine status output to db-benchmark-test. Make engine...

[t:4136] #4136 Add engine status output to db-benchmark-test.  Make engine status output available for scanscan even if not verbose.

git-svn-id: file:///svn/toku/tokudb@36929 c7de825b-a66e-492c-adef-691d508d4ae1
parent ce3eafc4
......@@ -22,6 +22,7 @@
#endif
int verbose=1;
int engine_status = 0;
int which;
enum { SERIAL_SPACING = 1<<6 };
......@@ -355,6 +356,8 @@ static void benchmark_shutdown (void) {
r = db->close(db, 0);
assert(r == 0);
}
if (engine_status)
print_engine_status(dbenv);
r = dbenv->close(dbenv, 0);
assert(r == 0);
}
......@@ -551,6 +554,7 @@ static int print_usage (const char *argv0) {
fprintf(stderr, " --redzone N redzone in percent\n");
fprintf(stderr, " --srandom N srandom(N)\n");
fprintf(stderr, " n_iterations how many iterations (default %lld)\n", default_n_items/DEFAULT_ITEMS_TO_INSERT_PER_ITERATION);
fprintf(stderr, " --engine_status print engine status at end of test \n");
return 1;
}
......@@ -711,6 +715,8 @@ static int test_main (int argc, char *const argv[]) {
redzone = atoi(argv[++i]);
} else if (strcmp(arg, "--optimize") == 0) {
do_optimize = 1;
} else if (strcmp(arg, "--engine_status") == 0) {
engine_status = 1;
} else {
return print_usage(argv[0]);
}
......
......@@ -29,6 +29,7 @@ static int n_experiments = 2;
static int bulk_fetch = 1;
static int verbose = 0;
static int engine_status = 0;
static const char *log_dir = NULL;
......@@ -54,6 +55,7 @@ static int print_usage (const char *argv0) {
fprintf(stderr, " --recover run recovery\n");
fprintf(stderr, " --verbose print verbose information\n");
fprintf(stderr, " --bulk_fetch 0|1 do bulk fetch on lwc operations (default: 1)\n");
fprintf(stderr, " --engine_status print engine status at end of test \n");
return 1;
}
......@@ -147,6 +149,8 @@ static void parse_args (int argc, char *const argv[]) {
} else if (strcmp(*argv, "--bulk_fetch") == 0 && argc > 1) {
argc--; argv++;
bulk_fetch = atoi(*argv);
} else if (strcmp(*argv, "--engine_status") == 0) {
engine_status = 1;
} else {
exit(print_usage(pname));
}
......@@ -231,6 +235,8 @@ static void scanscan_shutdown (void) {
if (do_txns) {
r = tid->commit(tid, 0); assert(r==0);
}
if (verbose || engine_status)
print_engine_status(env);
r = env->close(env, 0); assert(r==0);
env = NULL;
......@@ -246,19 +252,6 @@ static void scanscan_shutdown (void) {
}
static void print_engine_status(void) {
#if defined TOKUDB
if (verbose) {
int buffsize = 1024 * 32;
char buff[buffsize];
env->get_engine_status_text(env, buff, buffsize);
printf("Engine status:\n");
printf("%s", buff);
}
#endif
}
static void scanscan_hwc (void) {
int r;
int counter=0;
......@@ -285,7 +278,6 @@ static void scanscan_hwc (void) {
double thistime = gettime();
double tdiff = thistime-prevtime;
printf("Scan %lld bytes (%d rows) in %9.6fs at %9fMB/s\n", totalbytes, rowcounter, tdiff, 1e-6*totalbytes/tdiff);
print_engine_status();
}
}
......@@ -335,7 +327,6 @@ static void scanscan_lwc (void) {
double thistime = gettime();
double tdiff = thistime-prevtime;
printf("LWC Scan %lld bytes (%d rows) in %9.6fs at %9fMB/s\n", e.totalbytes, e.rowcounter, tdiff, 1e-6*e.totalbytes/tdiff);
print_engine_status();
}
}
......@@ -470,7 +461,6 @@ static void scanscan_verify (void) {
double thistime = gettime();
double tdiff = thistime-prevtime;
printf("verify %lld bytes (%d rows) in %9.6fs at %9fMB/s\n", v.totalbytes, v.rowcounter, tdiff, 1e-6*v.totalbytes/tdiff);
print_engine_status();
}
}
......
......@@ -29,5 +29,17 @@ main(int argc, char *const argv[]) {
return r;
}
static __attribute__((__unused__)) void
print_engine_status(DB_ENV * UU(env)) {
#if defined(TOKUDB)
int buffsize = 1024 * 128;
char buff[buffsize];
env->get_engine_status_text(env, buff, buffsize);
printf("Engine status:\n");
printf("%s", buff);
#endif
}
#endif /* #if !defined(TOKUDB_COMMON_H) */
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