From: Brian Aker Date: Sat, 14 Sep 2013 13:02:05 +0000 (-0400) Subject: Number to define X-Git-Tag: 1.0.18~19^2~1 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=3a983b168f3ffd3809bb5dbe5a1a0c21e97e3e5d;p=awesomized%2Flibmemcached Number to define --- diff --git a/clients/generator.cc b/clients/generator.cc index df805153..1f40daed 100644 --- a/clients/generator.cc +++ b/clients/generator.cc @@ -22,6 +22,8 @@ #include "clients/generator.h" +#define KEY_BYTES 20 + /* Use this for string generation */ static const char ALPHANUMERICS[]= "0123456789ABCDEFGHIJKLMNOPQRSTWXYZabcdefghijklmnopqrstuvwxyz"; @@ -75,13 +77,13 @@ pairs_st *pairs_generate(uint64_t number_of, size_t value_length) for (uint64_t x= 0; x < number_of; x++) { - pairs[x].key= (char *)calloc(100, sizeof(char)); + pairs[x].key= (char *)calloc(KEY_BYTES, sizeof(char)); if (pairs[x].key == NULL) goto error; - get_random_string(pairs[x].key, 100); - pairs[x].key_length= 100; + get_random_string(pairs[x].key, KEY_BYTES); + pairs[x].key_length= KEY_BYTES; if (value_length) { diff --git a/clients/memslap.cc b/clients/memslap.cc index 05a491fb..9bc4f238 100644 --- a/clients/memslap.cc +++ b/clients/memslap.cc @@ -66,6 +66,8 @@ #define DEFAULT_EXECUTE_NUMBER 10000 #define DEFAULT_CONCURRENCY 1 +#define VALUE_BYTES 4096 + #define PROGRAM_NAME "memslap" #define PROGRAM_DESCRIPTION "Generates a load against a memcached custer of servers." @@ -336,7 +338,7 @@ void scheduler(memcached_server_st *servers, conclusions_st *conclusion) if (opt_test == SET_TEST) { - context->execute_pairs= pairs_generate(opt_execute_number, 400); + context->execute_pairs= pairs_generate(opt_execute_number, VALUE_BYTES); context->execute_number= opt_execute_number; } @@ -432,7 +434,7 @@ void options_parse(int argc, char *argv[]) break; case OPT_DEBUG: /* --debug or -d */ - opt_verbose = OPT_DEBUG; + opt_verbose= OPT_DEBUG; break; case OPT_VERSION: /* --version or -V */ @@ -566,7 +568,7 @@ pairs_st *load_create_data(memcached_st *memc, unsigned int number_of, /* We always used non-blocking IO for load since it is faster */ memcached_behavior_set(memc_clone, MEMCACHED_BEHAVIOR_NO_BLOCK, 0); - pairs_st *pairs= pairs_generate(number_of, 400); + pairs_st *pairs= pairs_generate(number_of, VALUE_BYTES); *actual_loaded= execute_set(memc_clone, pairs, number_of); memcached_free(memc_clone);