Commit 2b8d2634 authored by Yoni Fogel's avatar Yoni Fogel

[t:5027] Made cli_args accessible through args. Removed redundant variables.

git-svn-id: file:///svn/toku/tokudb@44373 c7de825b-a66e-492c-adef-691d508d4ae1
parent 5574a100
......@@ -124,7 +124,7 @@ static void checkpoint_callback_2(void * extra) {
//
static int checkpoint_var(DB_TXN *txn, ARG arg, void* operation_extra, void *stats_extra) {
int db_index = random()%arg->num_DBs;
int db_index = random() % arg->cli->num_DBs;
int r = 0;
int val_size = *(int *)operation_extra;
DB* db = arg->dbp[db_index];
......@@ -138,7 +138,7 @@ static int checkpoint_var(DB_TXN *txn, ARG arg, void* operation_extra, void *sta
increment_counter(stats_extra, PTQUERIES, i);
for (i = 0; i < 20; i++) {
// do a random insertion
int rand_key = random() % arg->num_elements;
int rand_key = random() % arg->cli->num_elements;
DBT key, val;
r = db->put(
db,
......@@ -160,7 +160,6 @@ static void
stress_table(DB_ENV* env, DB** dbp, struct cli_args *cli_args) {
db_env_set_checkpoint_callback(checkpoint_callback_1, env);
db_env_set_checkpoint_callback2(checkpoint_callback_2, env);
int n = cli_args->num_elements;
//
// the threads that we want:
// - some threads constantly updating random values
......@@ -174,11 +173,10 @@ stress_table(DB_ENV* env, DB** dbp, struct cli_args *cli_args) {
const int num_threads = cli_args->num_ptquery_threads;
struct arg myargs[num_threads];
for (int i = 0; i < num_threads; i++) {
arg_init(&myargs[i], n, dbp, env, cli_args);
arg_init(&myargs[i], dbp, env, cli_args);
}
for (int i = 0; i < num_threads; i++) {
myargs[i].operation = checkpoint_var;
myargs[i].crash_on_operation_failure = false;
myargs[i].operation_extra = &val_size;
}
run_workers(myargs, num_threads, cli_args->time_of_test, false, cli_args);
......@@ -190,6 +188,7 @@ test_main(int argc, char *const argv[]) {
args.env_args.checkpointing_period = 30;
args.num_DBs = 4;
args.num_ptquery_threads = 4;
args.crash_on_operation_failure = false;
parse_stress_test_args(argc, argv, &args);
stress_test_main(&args);
return 0;
......
......@@ -20,7 +20,6 @@
static void
stress_table(DB_ENV* env, DB** dbp, struct cli_args *cli_args) {
int n = cli_args->num_elements;
//
// the threads that we want:
// - some threads constantly updating random values
......@@ -33,9 +32,7 @@ stress_table(DB_ENV* env, DB** dbp, struct cli_args *cli_args) {
const int num_threads = cli_args->num_ptquery_threads;
struct arg myargs[num_threads];
for (int i = 0; i < num_threads; i++) {
arg_init(&myargs[i], n, dbp, env, cli_args);
}
for (int i = 0; i < num_threads; i++) {
arg_init(&myargs[i], dbp, env, cli_args);
myargs[i].operation = cursor_create_close_op;
}
run_workers(myargs, num_threads, cli_args->time_of_test, false, cli_args);
......
......@@ -21,14 +21,11 @@
static void
stress_table(DB_ENV* env, DB** dbp, struct cli_args *cli_args) {
int n = cli_args->num_elements;
if (verbose) printf("starting creation of pthreads\n");
const int num_threads = cli_args->num_put_threads;
struct arg myargs[num_threads];
for (int i = 0; i < num_threads; i++) {
arg_init(&myargs[i], n, dbp, env, cli_args);
}
for (int i = 0; i < num_threads; i++) {
arg_init(&myargs[i], dbp, env, cli_args);
myargs[i].operation = random_put_op_singledb;
}
run_workers(myargs, num_threads, cli_args->time_of_test, false, cli_args);
......
......@@ -22,14 +22,11 @@
static void
stress_table(DB_ENV* env, DB** dbp, struct cli_args *cli_args) {
int n = cli_args->num_elements;
if (verbose) printf("starting creation of pthreads\n");
const int num_threads = cli_args->num_ptquery_threads;
struct arg myargs[num_threads];
for (int i = 0; i < num_threads; i++) {
arg_init(&myargs[i], n, dbp, env, cli_args);
}
for (int i = 0; i < num_threads; i++) {
arg_init(&myargs[i], dbp, env, cli_args);
myargs[i].operation = malloc_free_op;
}
run_workers(myargs, num_threads, cli_args->time_of_test, false, cli_args);
......
......@@ -20,14 +20,11 @@
static void
stress_table(DB_ENV* env, DB** dbp, struct cli_args *cli_args) {
int n = cli_args->num_elements;
if (verbose) printf("starting creation of pthreads\n");
const int num_threads = cli_args->num_ptquery_threads;
struct arg myargs[num_threads];
for (int i = 0; i < num_threads; i++) {
arg_init(&myargs[i], n, dbp, env, cli_args);
}
for (int i = 0; i < num_threads; i++) {
arg_init(&myargs[i], dbp, env, cli_args);
myargs[i].operation = nop;
}
run_workers(myargs, num_threads, cli_args->time_of_test, false, cli_args);
......
......@@ -40,7 +40,6 @@
static void
stress_table(DB_ENV* env, DB** dbp, struct cli_args *cli_args) {
int n = cli_args->num_elements;
//
// the threads that we want:
// - some threads constantly updating random values
......@@ -53,9 +52,7 @@ stress_table(DB_ENV* env, DB** dbp, struct cli_args *cli_args) {
const int num_threads = cli_args->num_ptquery_threads;
struct arg myargs[num_threads];
for (int i = 0; i < num_threads; i++) {
arg_init(&myargs[i], n, dbp, env, cli_args);
}
for (int i = 0; i < num_threads; i++) {
arg_init(&myargs[i], dbp, env, cli_args);
myargs[i].operation = ptquery_op;
}
run_workers(myargs, num_threads, cli_args->time_of_test, false, cli_args);
......
......@@ -50,7 +50,6 @@ static int ptquery_op2(DB_TXN *txn, ARG arg, void* operation_extra, void *stats_
static void
stress_table(DB_ENV* env, DB** dbp, struct cli_args *cli_args) {
int n = cli_args->num_elements;
//
// the threads that we want:
// - some threads constantly updating random values
......@@ -64,9 +63,7 @@ stress_table(DB_ENV* env, DB** dbp, struct cli_args *cli_args) {
struct arg myargs[num_threads];
int thread_ids[num_threads];
for (int i = 0; i < num_threads; i++) {
arg_init(&myargs[i], n, dbp, env, cli_args);
}
for (int i = 0; i < num_threads; i++) {
arg_init(&myargs[i], dbp, env, cli_args);
thread_ids[i] = i % cli_args->num_DBs;
myargs[i].operation = ptquery_op2;
myargs[i].operation_extra = &thread_ids[i];
......
......@@ -20,14 +20,11 @@
static void
stress_table(DB_ENV* env, DB** dbp, struct cli_args *cli_args) {
int n = cli_args->num_elements;
if (verbose) printf("starting creation of pthreads\n");
const int num_threads = cli_args->num_ptquery_threads;
struct arg myargs[num_threads];
for (int i = 0; i < num_threads; i++) {
arg_init(&myargs[i], n, dbp, env, cli_args);
}
for (int i = 0; i < num_threads; i++) {
arg_init(&myargs[i], dbp, env, cli_args);
myargs[i].operation = xmalloc_free_op;
}
run_workers(myargs, num_threads, cli_args->time_of_test, false, cli_args);
......
......@@ -46,8 +46,6 @@ static void flt_callback(int flt_state, void* extra) {
static void
stress_table(DB_ENV *env, DB **dbp, struct cli_args *cli_args) {
int n = cli_args->num_elements;
//
// the threads that we want:
// - one thread constantly updating random values
......@@ -60,7 +58,7 @@ stress_table(DB_ENV *env, DB **dbp, struct cli_args *cli_args) {
const int num_threads = 1;
struct arg myargs[num_threads];
for (int i = 0; i < num_threads; i++) {
arg_init(&myargs[i], n, dbp, env, cli_args);
arg_init(&myargs[i], dbp, env, cli_args);
}
// make the guy that updates the db
......
......@@ -40,8 +40,6 @@
static void
stress_table(DB_ENV *env, DB **dbp, struct cli_args *cli_args) {
int n = cli_args->num_elements;
//
// the threads that we want:
// - one thread constantly updating random values
......@@ -54,7 +52,7 @@ stress_table(DB_ENV *env, DB **dbp, struct cli_args *cli_args) {
const int num_threads = 4 + cli_args->num_update_threads + cli_args->num_ptquery_threads;
struct arg myargs[num_threads];
for (int i = 0; i < num_threads; i++) {
arg_init(&myargs[i], n, dbp, env, cli_args);
arg_init(&myargs[i], dbp, env, cli_args);
}
struct scan_op_extra soe[4];
......
......@@ -18,15 +18,13 @@
static void
stress_table(DB_ENV *env, DB **dbp, struct cli_args *cli_args) {
int n = cli_args->num_elements;
if (verbose) printf("starting creation of pthreads\n");
const int num_threads = cli_args->num_update_threads;
struct arg myargs[num_threads];
struct update_op_args uoe = get_update_op_args(cli_args, NULL);
// make the guy that updates the db
for (int i = 0; i < 0 + cli_args->num_update_threads; ++i) {
arg_init(&myargs[i], n, dbp, env, cli_args);
arg_init(&myargs[i], dbp, env, cli_args);
myargs[i].operation_extra = &uoe;
myargs[i].operation = update_op;
}
......
......@@ -64,8 +64,6 @@ static int manual_checkpoint(DB_TXN *UU(txn), ARG UU(arg), void* operation_extra
static void
stress_table(DB_ENV *env, DB **dbp, struct cli_args *cli_args) {
int n = cli_args->num_elements;
//
// the threads that we want:
// - one thread constantly updating random values
......@@ -78,7 +76,7 @@ stress_table(DB_ENV *env, DB **dbp, struct cli_args *cli_args) {
const int num_threads = 5 + cli_args->num_update_threads + cli_args->num_ptquery_threads;
struct arg myargs[num_threads];
for (int i = 0; i < num_threads; i++) {
arg_init(&myargs[i], n, dbp, env, cli_args);
arg_init(&myargs[i], dbp, env, cli_args);
}
struct scan_op_extra soe[4];
......
......@@ -26,14 +26,11 @@ static int random_sleep(DB_TXN* UU(txn), ARG UU(arg), void* UU(operation_extra),
static void
stress_table(DB_ENV* env, DB** dbp, struct cli_args *cli_args) {
int n = cli_args->num_elements;
if (verbose) printf("starting creation of pthreads\n");
const int num_threads = cli_args->num_ptquery_threads;
struct arg myargs[num_threads];
for (int i = 0; i < num_threads; i++) {
arg_init(&myargs[i], n, dbp, env, cli_args);
}
for (int i = 0; i < num_threads; i++) {
arg_init(&myargs[i], dbp, env, cli_args);
myargs[i].operation = random_sleep;
}
run_workers(myargs, num_threads, cli_args->time_of_test, false, cli_args);
......
......@@ -40,8 +40,6 @@
static void
stress_table(DB_ENV *env, DB **dbp, struct cli_args *cli_args) {
int n = cli_args->num_elements;
//
// the threads that we want:
// - some threads constantly updating random values
......@@ -54,7 +52,7 @@ stress_table(DB_ENV *env, DB **dbp, struct cli_args *cli_args) {
const int num_threads = 4 + cli_args->num_update_threads + cli_args->num_ptquery_threads;
struct arg myargs[num_threads];
for (int i = 0; i < num_threads; i++) {
arg_init(&myargs[i], n, dbp, env, cli_args);
arg_init(&myargs[i], dbp, env, cli_args);
}
struct scan_op_extra soe[4];
......
......@@ -34,8 +34,6 @@
static void
stress_table(DB_ENV *env, DB **dbp, struct cli_args *cli_args) {
int n = cli_args->num_elements;
//
// the threads that we want:
// - one thread constantly updating random values
......@@ -48,7 +46,7 @@ stress_table(DB_ENV *env, DB **dbp, struct cli_args *cli_args) {
const int num_threads = 4 + cli_args->num_update_threads + cli_args->num_ptquery_threads;
struct arg myargs[num_threads];
for (int i = 0; i < num_threads; i++) {
arg_init(&myargs[i], n, dbp, env, cli_args);
arg_init(&myargs[i], dbp, env, cli_args);
}
struct scan_op_extra soe[4];
......
......@@ -33,8 +33,6 @@
static void
stress_table(DB_ENV *env, DB **dbp, struct cli_args *cli_args) {
int n = cli_args->num_elements;
//
// the threads that we want:
// - one thread constantly updating random values
......@@ -46,7 +44,7 @@ stress_table(DB_ENV *env, DB **dbp, struct cli_args *cli_args) {
const int num_threads = 5 + cli_args->num_update_threads + cli_args->num_ptquery_threads;
struct arg myargs[num_threads];
for (int i = 0; i < num_threads; i++) {
arg_init(&myargs[i], n, dbp, env, cli_args);
arg_init(&myargs[i], dbp, env, cli_args);
}
struct scan_op_extra soe[4];
......
......@@ -34,7 +34,6 @@
static void
stress_table(DB_ENV *env, DB **dbp, struct cli_args *cli_args) {
int n = cli_args->num_elements;
//
// the threads that we want:
// - one thread constantly updating random values
......@@ -46,7 +45,7 @@ stress_table(DB_ENV *env, DB **dbp, struct cli_args *cli_args) {
const int num_threads = 4 + cli_args->num_update_threads + cli_args->num_ptquery_threads;
struct arg myargs[num_threads];
for (int i = 0; i < num_threads; i++) {
arg_init(&myargs[i], n, dbp, env, cli_args);
arg_init(&myargs[i], dbp, env, cli_args);
}
struct scan_op_extra soe[4];
......
......@@ -18,8 +18,6 @@
static void
stress_table(DB_ENV *env, DB **dbp, struct cli_args *cli_args) {
int n = cli_args->num_elements;
//
// do insertions and queries with a loader lying around doing stuff
//
......@@ -28,7 +26,7 @@ stress_table(DB_ENV *env, DB **dbp, struct cli_args *cli_args) {
const int num_threads = 4 + cli_args->num_update_threads + cli_args->num_ptquery_threads;
struct arg myargs[num_threads];
for (int i = 0; i < num_threads; i++) {
arg_init(&myargs[i], n, dbp, env, cli_args);
arg_init(&myargs[i], dbp, env, cli_args);
}
struct scan_op_extra soe[2];
......
......@@ -34,8 +34,6 @@
static void
stress_table(DB_ENV *env, DB **dbp, struct cli_args *cli_args) {
int n = cli_args->num_elements;
//
// the threads that we want:
// - one thread constantly updating random values
......@@ -48,7 +46,7 @@ stress_table(DB_ENV *env, DB **dbp, struct cli_args *cli_args) {
const int num_threads = 5 + cli_args->num_update_threads + cli_args->num_ptquery_threads;
struct arg myargs[num_threads];
for (int i = 0; i < num_threads; i++) {
arg_init(&myargs[i], n, dbp, env, cli_args);
arg_init(&myargs[i], dbp, env, cli_args);
}
struct scan_op_extra soe[4];
......
......@@ -18,8 +18,6 @@
static void
stress_table(DB_ENV *env, DB **dbp, struct cli_args *cli_args) {
int n = cli_args->num_elements;
//
// do insertions and queries with a loader lying around doing stuff
//
......@@ -28,7 +26,7 @@ stress_table(DB_ENV *env, DB **dbp, struct cli_args *cli_args) {
const int num_threads = 4 + cli_args->num_update_threads + cli_args->num_ptquery_threads;
struct arg myargs[num_threads];
for (int i = 0; i < num_threads; i++) {
arg_init(&myargs[i], n, dbp, env, cli_args);
arg_init(&myargs[i], dbp, env, cli_args);
}
struct scan_op_extra soe[2];
......
......@@ -24,8 +24,6 @@
static void
stress_table(DB_ENV *env, DB **dbp, struct cli_args *cli_args) {
int n = cli_args->num_elements;
//
// do insertions and queries with a loader lying around doing stuff
//
......@@ -34,7 +32,7 @@ stress_table(DB_ENV *env, DB **dbp, struct cli_args *cli_args) {
const int num_threads = 4 + cli_args->num_update_threads + cli_args->num_ptquery_threads;
struct arg myargs[num_threads];
for (int i = 0; i < num_threads; i++) {
arg_init(&myargs[i], n, dbp, env, cli_args);
arg_init(&myargs[i], dbp, env, cli_args);
}
// make the forward fast scanner
struct scan_op_extra soe;
......
This diff is collapsed.
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