Commit 4f21a8ed authored by John Esmet's avatar John Esmet Committed by Yoni Fogel

refs #5801 actually, don't do this just yet - needs a little more


git-svn-id: file:///svn/toku/tokudb@51157 c7de825b-a66e-492c-adef-691d508d4ae1
parent 4302af87
......@@ -120,7 +120,7 @@ test_main(int argc, char *const argv[]) {
args.num_DBs = 4;
args.txn_size = 1000;
args.key_size = 8;
args.val_size = 32;
args.val_size = 8;
parse_stress_test_args(argc, argv, &args);
// when there are multiple threads, its valid for two of them to
// generate the same key and one of them fail with DB_LOCK_NOTGRANTED
......@@ -128,6 +128,6 @@ test_main(int argc, char *const argv[]) {
args.crash_on_operation_failure = false;
}
args.env_args.generate_put_callback = iibench_generate_row_for_put;
stress_test_main(&args);
stress_test_main_with_cmp(&args, stress_uint64_dbt_cmp);
return 0;
}
......@@ -51,6 +51,6 @@ test_main(int argc, char *const argv[]) {
if (args.num_put_threads > 1) {
args.crash_on_operation_failure = false;
}
stress_test_main(&args);
stress_test_main_with_cmp(&args, stress_uint64_dbt_cmp);
return 0;
}
......@@ -8,13 +8,14 @@
#define _THREADED_STRESS_TEST_HELPERS_H_
#include <config.h>
#include "test.h"
#include <stdio.h>
#include <toku_stdlib.h>
#include <stdlib.h>
#include <locale.h>
#include <unistd.h>
#include <sys/stat.h>
#include <db.h>
#if defined(HAVE_MALLOC_H)
# include <malloc.h>
......@@ -86,6 +87,9 @@ enum perf_output_format {
HUMAN = 0,
CSV,
TSV,
#if 0
GNUPLOT,
#endif
NUM_OUTPUT_FORMATS
};
......@@ -395,6 +399,45 @@ tsv_print_perf_totals(const struct cli_args *cli_args, uint64_t *counters[], con
printf("\n");
}
#if 0
static void
gnuplot_print_perf_header(const struct cli_args *cli_args, const int num_threads)
{
printf("set terminal postscript solid color\n");
printf("set output \"foo.eps\"\n");
printf("set xlabel \"seconds\"\n");
printf("set xrange [0:*]\n");
printf("set ylabel \"X/s\"\n");
printf("plot ");
if (cli_args->print_thread_performance) {
for (int t = 1; t <= num_threads; ++t) {
for (int op = 0; op < (int) NUM_OPERATION_TYPES; ++op) {
const int col = (2 * ((t - 1) * (int) NUM_OPERATION_TYPES + op)) + 2;
//printf("'-' u 1:%d w lines t \"Thread %d %s\", ", col, t, operation_names[op]);
printf("'-' u 1:%d w lines t \"Thread %d %s/s\", ", col + 1, t, operation_names[op]);
}
}
}
for (int op = 0; op < (int) NUM_OPERATION_TYPES; ++op) {
const int col = (2 * (num_threads * (int) NUM_OPERATION_TYPES + op)) + 2;
//printf("'-' u 1:%d w lines t \"Total %s\", ", col);
printf("'-' u 1:%d w lines t \"Total %s/s\"%s", col + 1, operation_names[op], op == ((int) NUM_OPERATION_TYPES - 1) ? "\n" : ", ");
}
}
static void
gnuplot_print_perf_iteration(const struct cli_args *cli_args, const int current_time, uint64_t last_counters[][(int) NUM_OPERATION_TYPES], uint64_t *counters[], const int num_threads)
{
tsv_print_perf_iteration(cli_args, current_time, last_counters, counters, num_threads);
}
static void
gnuplot_print_perf_totals(const struct cli_args *UU(cli_args), uint64_t *UU(counters[]), const int UU(num_threads))
{
printf("e\n");
}
#endif
const struct perf_formatter perf_formatters[] = {
[HUMAN] = {
.header = human_print_perf_header,
......@@ -411,6 +454,13 @@ const struct perf_formatter perf_formatters[] = {
.iteration = tsv_print_perf_iteration,
.totals = tsv_print_perf_totals
},
#if 0
[GNUPLOT] = {
.header = gnuplot_print_perf_header,
.iteration = gnuplot_print_perf_iteration,
.totals = gnuplot_print_perf_totals
}
#endif
};
static int get_env_open_flags(struct cli_args *args) {
......@@ -1902,8 +1952,8 @@ static const struct env_args DEFAULT_PERF_ENV_ARGS = {
.generate_del_callback = NULL,
};
#define MIN_VAL_SIZE sizeof(uint64_t)
#define MIN_KEY_SIZE sizeof(uint64_t)
#define MIN_VAL_SIZE sizeof(int)
#define MIN_KEY_SIZE sizeof(int)
#define MIN_COMPRESSIBILITY (0.0)
#define MAX_COMPRESSIBILITY (1.0)
static struct cli_args UU() get_default_args(void) {
......@@ -2009,7 +2059,6 @@ DEFINE_NUMERIC_HELP(int64, PRId64, i64, INT64_MIN, INT64_MAX)
DEFINE_NUMERIC_HELP(uint32, PRIu32, u32, 0, UINT32_MAX)
DEFINE_NUMERIC_HELP(uint64, PRIu64, u64, 0, UINT64_MAX)
DEFINE_NUMERIC_HELP(double, ".2lf", d, -HUGE_VAL, HUGE_VAL)
static inline void
help_bool(struct arg_type *type, int width_name, int width_type) {
invariant(strncmp("--", type->name, strlen("--")));
......@@ -2397,8 +2446,13 @@ static inline void parse_stress_test_args (int argc, char *const argv[], struct
args->perf_output_format = CSV;
} else if (!strcmp(perf_format_s, "tsv")) {
args->perf_output_format = TSV;
#if 0
} else if (!strcmp(perf_format_s, "gnuplot")) {
args->perf_output_format = GNUPLOT;
#endif
} else {
fprintf(stderr, "valid values for --perf_format are \"human\", \"csv\", and \"tsv\"\n");
//fprintf(stderr, "valid values for --perf_format are \"human\", \"csv\", \"tsv\", and \"gnuplot\"\n");
do_usage(argv0, num_arg_types, arg_types);
exit(EINVAL);
}
......@@ -2414,26 +2468,16 @@ static void
stress_table(DB_ENV *, DB **, struct cli_args *);
static int
stress_dbt_cmp(DB *db, const DBT *a, const DBT *b) {
UU() stress_int_dbt_cmp (DB *db, const DBT *a, const DBT *b) {
assert(db && a && b);
assert(a->size >= MIN_KEY_SIZE);
assert(a->size == b->size);
uint64_t *x = (uint64_t *) a->data;
uint64_t *y = (uint64_t *) b->data;
uint64_t bytes_left = a->size;
while (bytes_left > 0) {
if (bytes_left < sizeof(uint64_t)) {
return memcmp(x, y, bytes_left);
} else if (*x < *y) {
return -1;
} else if (*x > *y) {
return 1;
}
x++;
y++;
bytes_left -= sizeof(uint64_t);
}
assert(a->size >= sizeof(int));
assert(b->size >= sizeof(int));
int x = *(int *) a->data;
int y = *(int *) b->data;
if (x<y) return -1;
if (x>y) return 1;
return 0;
}
......@@ -2514,7 +2558,7 @@ UU() stress_test_main_with_cmp(struct cli_args *args, int (*bt_compare)(DB *, co
static void
UU() stress_test_main(struct cli_args *args)
{
stress_test_main_with_cmp(args, stress_dbt_cmp);
stress_test_main_with_cmp(args, stress_int_dbt_cmp);
}
static void
......@@ -2525,7 +2569,7 @@ UU() stress_recover(struct cli_args *args) {
{ int chk_r = open_tables(&env,
dbs,
args->num_DBs,
stress_dbt_cmp,
stress_int_dbt_cmp,
args); CKERR(chk_r); }
DB_TXN* txn = NULL;
......
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