summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSusan LoVerso <sue@wiredtiger.com>2016-01-20 09:39:43 -0500
committerSusan LoVerso <sue@wiredtiger.com>2016-01-20 09:39:43 -0500
commitd88bc48a7a885fa8933bc8fbe0f44987c2d1f9c3 (patch)
tree9d82326a28f0c978886b1b3db83150c476d79f83
parent1743180fcf473f811ea9b76221ef3f1d91c8ac3a (diff)
downloadmongo-d88bc48a7a885fa8933bc8fbe0f44987c2d1f9c3.tar.gz
WT-2267 Minor updates to comments.
-rw-r--r--bench/wtperf/wtperf.c4
-rw-r--r--bench/wtperf/wtperf.h4
-rw-r--r--bench/wtperf/wtperf_throttle.c16
3 files changed, 13 insertions, 11 deletions
diff --git a/bench/wtperf/wtperf.c b/bench/wtperf/wtperf.c
index 7adf462309e..e5526880f2a 100644
--- a/bench/wtperf/wtperf.c
+++ b/bench/wtperf/wtperf.c
@@ -727,8 +727,8 @@ op_err: if (ret == WT_ROLLBACK && ops_per_txn != 0) {
op = thread->workload->ops;
/*
- * Decrement throttle tickets and check if needed check if we
- * should sleep and then get more tickets to perform more work.
+ * Decrement throttle ops and check if we should sleep
+ * and then get more work to perform.
*/
if (--thread->throttle_cfg.ops_count == 0)
worker_throttle(thread);
diff --git a/bench/wtperf/wtperf.h b/bench/wtperf/wtperf.h
index 989fd84135d..90922e1fc21 100644
--- a/bench/wtperf/wtperf.h
+++ b/bench/wtperf/wtperf.h
@@ -91,10 +91,10 @@ typedef struct {
int64_t insert; /* Insert ratio */
int64_t read; /* Read ratio */
int64_t update; /* Update ratio */
+ uint64_t throttle; /* Maximum operations/second */
/* Number of operations per transaction. Zero for autocommit */
int64_t ops_per_txn;
int64_t truncate; /* Truncate ratio */
- uint64_t throttle; /* Maximum operations/second */
uint64_t truncate_pct; /* Truncate Percent */
uint64_t truncate_count; /* Truncate Count */
@@ -301,8 +301,8 @@ void latency_print(CONFIG *);
int run_truncate(
CONFIG *, CONFIG_THREAD *, WT_CURSOR *, WT_SESSION *, int *);
int setup_log_file(CONFIG *);
-int setup_truncate(CONFIG *, CONFIG_THREAD *, WT_SESSION *);
int setup_throttle(CONFIG_THREAD*);
+int setup_truncate(CONFIG *, CONFIG_THREAD *, WT_SESSION *);
uint64_t sum_ckpt_ops(CONFIG *);
uint64_t sum_insert_ops(CONFIG *);
uint64_t sum_pop_ops(CONFIG *);
diff --git a/bench/wtperf/wtperf_throttle.c b/bench/wtperf/wtperf_throttle.c
index 6c11b214521..fcb3cf515b5 100644
--- a/bench/wtperf/wtperf_throttle.c
+++ b/bench/wtperf/wtperf_throttle.c
@@ -41,7 +41,7 @@ setup_throttle(CONFIG_THREAD *thread)
/*
* Setup how the number of operations to run each interval in order to
* meet our desired max throughput.
- * - If we have a very small number of then we can look to do one op
+ * - If we have a very small number of them we can do one op
* on a larger increment. Given there is overhead in throttle logic
* we want to avoid running the throttle check regularly.
* - For most workloads, we aim to do 100 ops per interval and adjust
@@ -51,7 +51,7 @@ setup_throttle(CONFIG_THREAD *thread)
*/
if (thread->workload->throttle < THROTTLE_OPS) {
- /* If the interval is very small, we do laps of 1 */
+ /* If the interval is very small, we do one operation */
throttle_cfg->usecs_increment =
USEC_PER_SEC / thread->workload->throttle;
throttle_cfg->ops_per_increment = 1;
@@ -66,7 +66,7 @@ setup_throttle(CONFIG_THREAD *thread)
thread->workload->throttle / THROTTLE_OPS;
}
- /* Give the queue some initial tickets to work with */
+ /* Give the queue some initial operations to work with */
throttle_cfg->ops_count = throttle_cfg->ops_per_increment;
/* Set the first timestamp of when we incremented */
@@ -75,8 +75,8 @@ setup_throttle(CONFIG_THREAD *thread)
}
/*
- * Run the throttle function. Will sleep if needed and then reload the counter
- * to perform more operations.
+ * Run the throttle function. We will sleep if needed and then reload the
+ * counter to perform more operations.
*/
int
worker_throttle(CONFIG_THREAD *thread)
@@ -91,7 +91,7 @@ worker_throttle(CONFIG_THREAD *thread)
/*
* If we did enough operations in the current interval, sleep for
- * the rest of the interval. Then add more tickets to the queue.
+ * the rest of the interval. Then add more operations to the queue.
*/
usecs_delta = WT_TIMEDIFF_US(now, throttle_cfg->last_increment);
if (usecs_delta < throttle_cfg->usecs_increment) {
@@ -111,7 +111,9 @@ worker_throttle(CONFIG_THREAD *thread)
throttle_cfg->last_increment = now;
}
- /* Don't over-fill the queue */
+ /*
+ * Take the minimum so we don't overfill the queue.
+ */
throttle_cfg->ops_count =
WT_MIN(throttle_cfg->ops_count, thread->workload->throttle);