void options_parse(int argc, char *argv[]);
void conclusions_print(conclusions_st *conclusion);
void scheduler(memcached_server_st *servers, conclusions_st *conclusion);
-pairs_st *load_initial_data(memcached_server_st *servers, unsigned int number_of,
+pairs_st *load_createial_data(memcached_server_st *servers, unsigned int number_of,
unsigned int *actual_loaded);
static int opt_verbose= 0;
static unsigned int opt_execute_number= 0;
-static unsigned int opt_initial_load= 0;
+static unsigned int opt_createial_load= 0;
static unsigned int opt_concurrency= 0;
static int opt_displayflag= 0;
static char *opt_servers= NULL;
free(opt_servers);
- (void)pthread_mutex_init(&counter_mutex, NULL);
- (void)pthread_cond_init(&count_threshhold, NULL);
- (void)pthread_mutex_init(&sleeper_mutex, NULL);
- (void)pthread_cond_init(&sleep_threshhold, NULL);
+ (void)pthread_mutex_destroy(&counter_mutex);
+ (void)pthread_cond_destroy(&count_threshhold);
+ (void)pthread_mutex_destroy(&sleeper_mutex);
+ (void)pthread_cond_destroy(&sleep_threshhold);
conclusions_print(&conclusion);
memcached_server_list_free(servers);
pthread_attr_setdetachstate(&attr,
PTHREAD_CREATE_DETACHED);
- if (opt_initial_load)
- pairs= load_initial_data(servers, opt_initial_load, &actual_loaded);
+ if (opt_createial_load)
+ pairs= load_createial_data(servers, opt_createial_load, &actual_loaded);
pthread_mutex_lock(&counter_mutex);
thread_counter= 0;
opt_execute_number= strtol(optarg, (char **)NULL, 10);
break;
case OPT_SLAP_INITIAL_LOAD:
- opt_initial_load= strtol(optarg, (char **)NULL, 10);
+ opt_createial_load= strtol(optarg, (char **)NULL, 10);
break;
case '?':
/* getopt_long already printed an error message. */
}
}
- if (opt_test == GET_TEST && opt_initial_load == 0)
- opt_initial_load= DEFAULT_INITIAL_LOAD;
+ if (opt_test == GET_TEST && opt_createial_load == 0)
+ opt_createial_load= DEFAULT_INITIAL_LOAD;
if (opt_execute_number == 0)
opt_execute_number= DEFAULT_EXECUTE_NUMBER;
thread_context_st *context= (thread_context_st *)p;
memcached_st *memc;
- memc= memcached_init(NULL);
+ memc= memcached_create(NULL);
memcached_server_push(memc, context->servers);
thread_counter--;
pthread_cond_signal(&count_threshhold);
pthread_mutex_unlock(&counter_mutex);
- memcached_deinit(memc);
+ memcached_free(memc);
free(context);
return NULL;
}
-pairs_st *load_initial_data(memcached_server_st *servers, unsigned int number_of,
+pairs_st *load_createial_data(memcached_server_st *servers, unsigned int number_of,
unsigned int *actual_loaded)
{
memcached_st *memc;
pairs_st *pairs;
- memc= memcached_init(NULL);
+ memc= memcached_create(NULL);
memcached_server_push(memc, servers);
pairs= pairs_generate(number_of);
*actual_loaded= execute_set(memc, pairs, number_of);
- memcached_deinit(memc);
+ memcached_free(memc);
return pairs;
}
{
memcached_st memc;
- (void)memcached_init(&memc);
- memcached_deinit(&memc);
+ (void)memcached_create(&memc);
+ memcached_free(&memc);
}
void allocation_test(void)
{
memcached_st *memc;
- memc= memcached_init(NULL);
+ memc= memcached_create(NULL);
assert(memc);
- memcached_deinit(memc);
+ memcached_free(memc);
}
void connection_test(void)
{
memcached_return rc;
memcached_st *memc;
- memc= memcached_init(NULL);
+ memc= memcached_create(NULL);
assert(memc);
rc= memcached_server_add(memc, "localhost", 0);
assert(rc == MEMCACHED_SUCCESS);
assert(memc);
- memcached_deinit(memc);
+ memcached_free(memc);
}
void error_test(void)
{
memcached_st *memc;
- memc= memcached_init(NULL);
+ memc= memcached_create(NULL);
memcached_return rc;
for (rc= MEMCACHED_SUCCESS; rc < MEMCACHED_MAXIMUM_RETURN; rc++)
}
assert(memc);
- memcached_deinit(memc);
+ memcached_free(memc);
}
void set_test(void)
char *key= "foo";
char *value= "when we sanitize";
- memc= memcached_init(NULL);
+ memc= memcached_create(NULL);
assert(memc);
rc= memcached_server_add(memc, "localhost", 0);
assert(rc == MEMCACHED_SUCCESS);
(time_t)0, (uint16_t)0);
assert(rc == MEMCACHED_SUCCESS);
- memcached_deinit(memc);
+ memcached_free(memc);
}
void add_test(void)
char *key= "foo";
char *value= "when we sanitize";
- memc= memcached_init(NULL);
+ memc= memcached_create(NULL);
assert(memc);
rc= memcached_server_add(memc, "localhost", 0);
assert(rc == MEMCACHED_SUCCESS);
(time_t)0, (uint16_t)0);
assert(rc == MEMCACHED_NOTSTORED);
- memcached_deinit(memc);
+ memcached_free(memc);
}
void replace_test(void)
char *key= "foo";
char *value= "when we sanitize";
- memc= memcached_init(NULL);
+ memc= memcached_create(NULL);
assert(memc);
rc= memcached_server_add(memc, "localhost", 0);
assert(rc == MEMCACHED_SUCCESS);
(time_t)0, (uint16_t)0);
assert(rc == MEMCACHED_SUCCESS);
- memcached_deinit(memc);
+ memcached_free(memc);
}
void delete_test(void)
char *key= "foo";
char *value= "when we sanitize";
- memc= memcached_init(NULL);
+ memc= memcached_create(NULL);
assert(memc);
rc= memcached_server_add(memc, "localhost", 0);
assert(rc == MEMCACHED_SUCCESS);
rc= memcached_delete(memc, key, strlen(key), (time_t)0);
assert(rc == MEMCACHED_SUCCESS);
- memcached_deinit(memc);
+ memcached_free(memc);
}
void flush_test(void)
memcached_st *memc;
memcached_return rc;
- memc= memcached_init(NULL);
+ memc= memcached_create(NULL);
assert(memc);
rc= memcached_server_add(memc, "localhost", 0);
assert(rc == MEMCACHED_SUCCESS);
rc= memcached_flush(memc, 0);
assert(rc == MEMCACHED_SUCCESS);
- memcached_deinit(memc);
+ memcached_free(memc);
}
void get_test(void)
size_t string_length;
uint16_t flags;
- memc= memcached_init(NULL);
+ memc= memcached_create(NULL);
assert(memc);
rc= memcached_server_add(memc, "localhost", 0);
assert(rc == MEMCACHED_SUCCESS);
assert(string_length == 0);
assert(!string);
- memcached_deinit(memc);
+ memcached_free(memc);
}
void get_test2(void)
size_t string_length;
uint16_t flags;
- memc= memcached_init(NULL);
+ memc= memcached_create(NULL);
assert(memc);
rc= memcached_server_add(memc, "localhost", 0);
assert(rc == MEMCACHED_SUCCESS);
free(string);
- memcached_deinit(memc);
+ memcached_free(memc);
}
void get_test3(void)
for (x= 0; x < value_length; x++)
value[x] = (char) (x % 127);
- memc= memcached_init(NULL);
+ memc= memcached_create(NULL);
assert(memc);
rc= memcached_server_add(memc, "localhost", 0);
assert(rc == MEMCACHED_SUCCESS);
free(string);
free(value);
- memcached_deinit(memc);
+ memcached_free(memc);
}
void get_test4(void)
for (x= 0; x < value_length; x++)
value[x] = (char) (x % 127);
- memc= memcached_init(NULL);
+ memc= memcached_create(NULL);
assert(memc);
rc= memcached_server_add(memc, "localhost", 0);
assert(rc == MEMCACHED_SUCCESS);
free(value);
- memcached_deinit(memc);
+ memcached_free(memc);
}
void stats_servername_test(void)
char *key= "number";
char *value= "0";
- memc= memcached_init(NULL);
+ memc= memcached_create(NULL);
assert(memc);
rc= memcached_server_add(memc, "localhost", 0);
assert(rc == MEMCACHED_SUCCESS);
assert(rc == MEMCACHED_SUCCESS);
assert(new_number == 2);
- memcached_deinit(memc);
+ memcached_free(memc);
}
void decrement_test(void)
char *key= "number";
char *value= "3";
- memc= memcached_init(NULL);
+ memc= memcached_create(NULL);
assert(memc);
rc= memcached_server_add(memc, "localhost", 0);
assert(rc == MEMCACHED_SUCCESS);
assert(rc == MEMCACHED_SUCCESS);
assert(new_number == 1);
- memcached_deinit(memc);
+ memcached_free(memc);
}
void quit_test(void)
char *key= "fudge";
char *value= "sanford and sun";
- memc= memcached_init(NULL);
+ memc= memcached_create(NULL);
assert(memc);
rc= memcached_server_add(memc, "localhost", 0);
assert(rc == MEMCACHED_SUCCESS);
(time_t)50, (uint16_t)9);
assert(rc == MEMCACHED_SUCCESS);
- memcached_deinit(memc);
+ memcached_free(memc);
}
void mget_test(void)
char *return_value;
size_t return_value_length;
- memc= memcached_init(NULL);
+ memc= memcached_create(NULL);
assert(memc);
rc= memcached_server_add(memc, "localhost", 0);
assert(rc == MEMCACHED_SUCCESS);
x++;
}
- memcached_deinit(memc);
+ memcached_free(memc);
}
void get_stats_keys(void)
memcached_stat_st stat;
memcached_return rc;
- memc= memcached_init(NULL);
+ memc= memcached_create(NULL);
assert(memc);
list= memcached_stat_get_keys(memc, &stat, &rc);
printf("Found key %s\n", *ptr);
free(list);
- memcached_deinit(memc);
+ memcached_free(memc);
}
void get_stats(void)
memcached_st *memc;
memcached_stat_st *stat;
- memc= memcached_init(NULL);
+ memc= memcached_create(NULL);
assert(memc);
rc= memcached_server_add(memc, "localhost", 0);
assert(rc == MEMCACHED_SUCCESS);
}
free(stat);
- memcached_deinit(memc);
+ memcached_free(memc);
}
void get_stats_multiple(void)
memcached_st *memc;
memcached_stat_st *stat;
- memc= memcached_init(NULL);
+ memc= memcached_create(NULL);
assert(memc);
rc= memcached_server_add(memc, "localhost", 0);
assert(rc == MEMCACHED_SUCCESS);
}
free(stat);
- memcached_deinit(memc);
+ memcached_free(memc);
}
void add_host_test(void)
memcached_return rc;
char servername[]= "0.example.com";
- memc= memcached_init(NULL);
+ memc= memcached_create(NULL);
assert(memc);
rc= memcached_server_add(memc, "localhost", 0);
assert(rc == MEMCACHED_SUCCESS);
assert(rc == MEMCACHED_SUCCESS);
memcached_server_list_free(servers);
- memcached_deinit(memc);
+ memcached_free(memc);
}
void add_host_test1(void)
memcached_return rc;
char servername[]= "0.example.com";
- memc= memcached_init(NULL);
+ memc= memcached_create(NULL);
assert(memc);
servers= memcached_server_list_append(NULL, servername, 400, &rc);
assert(rc == MEMCACHED_SUCCESS);
memcached_server_list_free(servers);
- memcached_deinit(memc);
+ memcached_free(memc);
}