summaryrefslogtreecommitdiff
path: root/bench
diff options
context:
space:
mode:
authorAlex Gorrod <alexg@wiredtiger.com>2016-01-22 16:24:05 +1100
committerAlex Gorrod <alexg@wiredtiger.com>2016-01-22 16:24:05 +1100
commit494022b3de6710136e72e9d292d58f1f33f57650 (patch)
treeea89f49fe59f4b0c67f091e7c083b2e186d52a80 /bench
parentb3c476ccdd30aeb1a9dea27a68b7a2dd528944b9 (diff)
downloadmongo-494022b3de6710136e72e9d292d58f1f33f57650.tar.gz
Fixup more compiler warnings.
Don't attempt to statically initialize a pthread_t
Diffstat (limited to 'bench')
-rw-r--r--bench/wtperf/idle_table_cycle.c15
-rw-r--r--bench/wtperf/wtperf.c11
-rw-r--r--bench/wtperf/wtperf.h5
3 files changed, 19 insertions, 12 deletions
diff --git a/bench/wtperf/idle_table_cycle.c b/bench/wtperf/idle_table_cycle.c
index a05fe2c9576..d80508a843e 100644
--- a/bench/wtperf/idle_table_cycle.c
+++ b/bench/wtperf/idle_table_cycle.c
@@ -145,8 +145,15 @@ cycle_idle_tables(void *arg)
return (NULL);
}
+/*
+ * Start a thread the creates and drops tables regularly.
+ * TODO: Currently accepts a pthread_t as a parameter, since it is not
+ * possible to portably staticially initialize it in the global configuration
+ * structure. Should reshuffle the configuration structure so explicit static
+ * initializers aren't necessary.
+ */
int
-start_idle_table_cycle(CONFIG *cfg)
+start_idle_table_cycle(CONFIG *cfg, pthread_t *idle_table_cycle_thread)
{
pthread_t thread_id;
int ret;
@@ -162,13 +169,13 @@ start_idle_table_cycle(CONFIG *cfg)
cfg->idle_cycle_run = false;
return (ret);
}
- cfg->idle_table_cycle_thread = thread_id;
+ *idle_table_cycle_thread = thread_id;
return (0);
}
int
-stop_idle_table_cycle(CONFIG *cfg)
+stop_idle_table_cycle(CONFIG *cfg, pthread_t idle_table_cycle_thread)
{
int ret;
@@ -176,7 +183,7 @@ stop_idle_table_cycle(CONFIG *cfg)
return (0);
cfg->idle_cycle_run = false;
- if ((ret = pthread_join(cfg->idle_table_cycle_thread, NULL)) != 0) {
+ if ((ret = pthread_join(idle_table_cycle_thread, NULL)) != 0) {
lprintf(
cfg, ret, 0, "Error joining idle table cycle thread.");
return (ret);
diff --git a/bench/wtperf/wtperf.c b/bench/wtperf/wtperf.c
index 15132249883..b2e68198e9a 100644
--- a/bench/wtperf/wtperf.c
+++ b/bench/wtperf/wtperf.c
@@ -57,7 +57,6 @@ static const CONFIG default_cfg = {
0, /* thread error */
0, /* notify threads to stop */
0, /* in warmup phase */
- NULL, /* Thread ID of idle cycle thread */
false, /* Signal for idle cycle thread */
0, /* total seconds running */
0, /* has truncate */
@@ -1361,6 +1360,7 @@ execute_populate(CONFIG *cfg)
struct timespec start, stop;
CONFIG_THREAD *popth;
WT_ASYNC_OP *asyncop;
+ pthread_t idle_table_cycle_thread;
size_t i;
uint64_t last_ops, msecs, print_ops_sec;
uint32_t interval, tables;
@@ -1374,7 +1374,7 @@ execute_populate(CONFIG *cfg)
cfg->populate_threads, cfg->icount);
/* Start cycling idle tables if configured. */
- if ((ret = start_idle_table_cycle(cfg)) != 0)
+ if ((ret = start_idle_table_cycle(cfg, &idle_table_cycle_thread)) != 0)
return (ret);
cfg->insert_key = 0;
@@ -1506,7 +1506,7 @@ execute_populate(CONFIG *cfg)
}
/* Stop cycling idle tables. */
- if ((ret = stop_idle_table_cycle(cfg)) != 0)
+ if ((ret = stop_idle_table_cycle(cfg, idle_table_cycle_thread)) != 0)
return (ret);
return (0);
@@ -1558,6 +1558,7 @@ execute_workload(CONFIG *cfg)
{
CONFIG_THREAD *threads;
WORKLOAD *workp;
+ pthread_t idle_table_cycle_thread;
uint64_t last_ckpts, last_inserts, last_reads, last_truncates;
uint64_t last_updates;
uint32_t interval, run_ops, run_time;
@@ -1574,7 +1575,7 @@ execute_workload(CONFIG *cfg)
ret = 0;
/* Start cycling idle tables. */
- if ((ret = start_idle_table_cycle(cfg)) != 0)
+ if ((ret = start_idle_table_cycle(cfg, &idle_table_cycle_thread)) != 0)
return (ret);
if (cfg->warmup != 0)
@@ -1673,7 +1674,7 @@ execute_workload(CONFIG *cfg)
err: cfg->stop = 1;
/* Stop cycling idle tables. */
- if ((ret = stop_idle_table_cycle(cfg)) != 0)
+ if ((ret = stop_idle_table_cycle(cfg, idle_table_cycle_thread)) != 0)
return (ret);
if ((t_ret = stop_threads(
diff --git a/bench/wtperf/wtperf.h b/bench/wtperf/wtperf.h
index 28d359dd8ef..7dbe1822a26 100644
--- a/bench/wtperf/wtperf.h
+++ b/bench/wtperf/wtperf.h
@@ -187,7 +187,6 @@ struct __config { /* Configuration structure */
volatile int stop; /* notify threads to stop */
volatile int in_warmup; /* Running warmup phase */
- pthread_t idle_table_cycle_thread; /* Thread ID of idle cycle thread */
volatile bool idle_cycle_run; /* Signal for idle cycle thread */
volatile uint32_t totalsec; /* total seconds running */
@@ -306,8 +305,8 @@ int run_truncate(
int setup_log_file(CONFIG *);
int setup_throttle(CONFIG_THREAD*);
int setup_truncate(CONFIG *, CONFIG_THREAD *, WT_SESSION *);
-int start_idle_table_cycle(CONFIG *);
-int stop_idle_table_cycle(CONFIG *);
+int start_idle_table_cycle(CONFIG *, pthread_t *);
+int stop_idle_table_cycle(CONFIG *, pthread_t);
uint64_t sum_ckpt_ops(CONFIG *);
uint64_t sum_insert_ops(CONFIG *);
uint64_t sum_pop_ops(CONFIG *);