diff options
author | Susan LoVerso <sue@wiredtiger.com> | 2014-02-03 14:22:34 -0500 |
---|---|---|
committer | Susan LoVerso <sue@wiredtiger.com> | 2014-02-03 14:22:34 -0500 |
commit | f676ff7f106c50febab56723b6fbba1f2a412a2c (patch) | |
tree | 743b76219341e4b188acd64522c566d07d42404a | |
parent | df506fcfa60b7c0ee525ecfaea472bb2788ed9f7 (diff) | |
download | mongo-f676ff7f106c50febab56723b6fbba1f2a412a2c.tar.gz |
Simplify random value initialization.
-rw-r--r-- | bench/wtperf/wtperf.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/bench/wtperf/wtperf.c b/bench/wtperf/wtperf.c index dee3e8bab2a..2f55596c7f4 100644 --- a/bench/wtperf/wtperf.c +++ b/bench/wtperf/wtperf.c @@ -1426,7 +1426,7 @@ static int start_threads(CONFIG *cfg, WORKLOAD *workp, CONFIG_THREAD *thread, u_int num, void *(*func)(void *)) { - u_int end, i, j; + u_int i; int ret; for (i = 0; i < num; ++i, ++thread) { @@ -1442,12 +1442,12 @@ start_threads(CONFIG *cfg, return (enomem(cfg)); if ((thread->value_buf = calloc(cfg->value_sz, 1)) == NULL) return (enomem(cfg)); - if (cfg->random_value) { - end = cfg->value_sz / sizeof(uint32_t); - for (j = 0; j < end; j+= sizeof(uint32_t)) - thread->value_buf[j] = (char)__wt_random(); - } else - memset(thread->value_buf, 'a', cfg->value_sz - 1); + /* + * Initialize and then toss in a bit of random values if needed. + */ + memset(thread->value_buf, 'a', cfg->value_sz - 1); + if (cfg->random_value) + randomize_value(cfg, thread->value_buf); /* * Every thread gets tracking information and is initialized |