X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=clients%2Fmemslap.c;h=7aa69eadf543f7b039269e89c038857a2b2a578f;hb=db4741c1f65edf1323e4aa0879c4589244af1971;hp=ee1920c73f5cda697c3ba60b051e3adb54634819;hpb=8af90ac15d8ba8ec464e5ad402ed2d27b95f81e3;p=awesomized%2Flibmemcached diff --git a/clients/memslap.c b/clients/memslap.c index ee1920c7..7aa69ead 100644 --- a/clients/memslap.c +++ b/clients/memslap.c @@ -6,7 +6,6 @@ #include #include #include -#include #include #include #include @@ -68,6 +67,7 @@ pairs_st *load_create_data(memcached_st *memc, unsigned int number_of, unsigned int *actual_loaded); void flush_all(memcached_st *memc); +static int opt_binary= 0; static int opt_verbose= 0; static int opt_flush= 0; static int opt_non_blocking_io= 0; @@ -141,6 +141,8 @@ void scheduler(memcached_server_st *servers, conclusions_st *conclusion) memc= memcached_create(NULL); memcached_server_push(memc, servers); + memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, opt_binary); + if (opt_flush) flush_all(memc); if (opt_createial_load) @@ -204,14 +206,7 @@ void scheduler(memcached_server_st *servers, conclusions_st *conclusion) */ pthread_mutex_lock(&counter_mutex); while (thread_counter) - { - struct timespec abstime; - - memset(&abstime, 0, sizeof(struct timespec)); - abstime.tv_sec= 1; - - pthread_cond_timedwait(&count_threshhold, &counter_mutex, &abstime); - } + pthread_cond_wait(&count_threshhold, &counter_mutex); pthread_mutex_unlock(&counter_mutex); gettimeofday(&end_time, NULL); @@ -219,6 +214,7 @@ void scheduler(memcached_server_st *servers, conclusions_st *conclusion) conclusion->load_time= timedif(end_time, start_time); conclusion->read_time= timedif(end_time, start_time); pairs_free(pairs); + memcached_free(memc); } void options_parse(int argc, char *argv[]) @@ -243,6 +239,7 @@ void options_parse(int argc, char *argv[]) {"test", required_argument, NULL, OPT_SLAP_TEST}, {"verbose", no_argument, &opt_verbose, OPT_VERBOSE}, {"version", no_argument, NULL, OPT_VERSION}, + {"binary", no_argument, NULL, OPT_BINARY}, {0, 0, 0, 0}, }; @@ -257,6 +254,9 @@ void options_parse(int argc, char *argv[]) { case 0: break; + case OPT_BINARY: + opt_binary = 1; + break; case OPT_VERBOSE: /* --verbose or -v */ opt_verbose = OPT_VERBOSE; break; @@ -285,6 +285,7 @@ void options_parse(int argc, char *argv[]) break; case OPT_SLAP_CONCURRENCY: opt_concurrency= strtol(optarg, (char **)NULL, 10); + break; case OPT_SLAP_EXECUTE_NUMBER: opt_execute_number= strtol(optarg, (char **)NULL, 10); break; @@ -353,6 +354,7 @@ void *run_task(void *p) if (context->execute_pairs) pairs_free(context->execute_pairs); + free(context); pthread_mutex_lock(&counter_mutex);