@@ -62,11 +62,14 @@ struct conclusions_st {
62
62
void options_parse (int argc , char * argv []);
63
63
void conclusions_print (conclusions_st * conclusion );
64
64
void scheduler (memcached_server_st * servers , conclusions_st * conclusion );
65
- pairs_st * load_createial_data (memcached_server_st * servers , unsigned int number_of ,
65
+ pairs_st * load_create_data (memcached_server_st * servers , unsigned int number_of ,
66
66
unsigned int * actual_loaded );
67
+ void flush_all (memcached_server_st * servers );
67
68
68
69
static int opt_verbose = 0 ;
70
+ static int opt_flush = 0 ;
69
71
static int opt_non_blocking_io = 0 ;
72
+ static int opt_tcp_nodelay = 0 ;
70
73
static unsigned int opt_execute_number = 0 ;
71
74
static unsigned int opt_createial_load = 0 ;
72
75
static unsigned int opt_concurrency = 0 ;
@@ -122,8 +125,10 @@ void scheduler(memcached_server_st *servers, conclusions_st *conclusion)
122
125
pthread_attr_setdetachstate (& attr ,
123
126
PTHREAD_CREATE_DETACHED );
124
127
128
+ if (opt_flush )
129
+ flush_all (servers );
125
130
if (opt_createial_load )
126
- pairs = load_createial_data (servers , opt_createial_load , & actual_loaded );
131
+ pairs = load_create_data (servers , opt_createial_load , & actual_loaded );
127
132
128
133
pthread_mutex_lock (& counter_mutex );
129
134
thread_counter = 0 ;
@@ -203,10 +208,12 @@ void options_parse(int argc, char *argv[])
203
208
{"debug" , no_argument , & opt_verbose , OPT_DEBUG },
204
209
{"execute-number" , required_argument , NULL , OPT_SLAP_EXECUTE_NUMBER },
205
210
{"flag" , no_argument , & opt_displayflag , OPT_FLAG },
211
+ {"flush" , no_argument , & opt_flush , OPT_FLUSH },
206
212
{"help" , no_argument , NULL , OPT_HELP },
207
213
{"initial-load" , required_argument , NULL , OPT_SLAP_INITIAL_LOAD }, /* Number to load initially */
208
214
{"non-blocking" , no_argument , & opt_non_blocking_io , OPT_SLAP_NON_BLOCK },
209
215
{"servers" , required_argument , NULL , OPT_SERVERS },
216
+ {"tcp-nodelay" , no_argument , & opt_tcp_nodelay , OPT_SLAP_TCP_NODELAY },
210
217
{"test" , required_argument , NULL , OPT_SLAP_TEST },
211
218
{"verbose" , no_argument , & opt_verbose , OPT_VERBOSE },
212
219
{"version" , no_argument , NULL , OPT_VERSION },
@@ -299,6 +306,8 @@ void *run_task(void *p)
299
306
memc = memcached_create (NULL );
300
307
if (opt_non_blocking_io )
301
308
memcached_behavior_set (memc , MEMCACHED_BEHAVIOR_NO_BLOCK , NULL );
309
+ if (opt_tcp_nodelay )
310
+ memcached_behavior_set (memc , MEMCACHED_BEHAVIOR_TCP_NODELAY , NULL );
302
311
303
312
memcached_server_push (memc , context -> servers );
304
313
@@ -333,7 +342,20 @@ void *run_task(void *p)
333
342
return NULL ;
334
343
}
335
344
336
- pairs_st * load_createial_data (memcached_server_st * servers , unsigned int number_of ,
345
+ void flush_all (memcached_server_st * servers )
346
+ {
347
+ memcached_st * memc ;
348
+
349
+ memc = memcached_create (NULL );
350
+
351
+ memcached_server_push (memc , servers );
352
+
353
+ memcached_flush (memc , 0 );
354
+
355
+ memcached_free (memc );
356
+ }
357
+
358
+ pairs_st * load_create_data (memcached_server_st * servers , unsigned int number_of ,
337
359
unsigned int * actual_loaded )
338
360
{
339
361
memcached_st * memc ;
0 commit comments