* Mingqiang Zhuang <mingqiangzhuang@hengtiansoft.com>
*
*/
+#include "config.h"
+
#include <stdlib.h>
#include <getopt.h>
#include <limits.h>
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+
#include "ms_sigsegv.h"
#include "ms_setting.h"
{
printf(" -%c, --%s%c\n", long_options[x].val, long_options[x].name,
long_options[x].has_arg ? '=' : ' ');
+
if ((help_message= (char *)ms_lookup_help(long_options[x].val)) != NULL)
{
printf(" %s\n", help_message);
break;
case OPT_CONCURRENCY: /* --concurrency or -c */
- ms_setting.nconns= (int)strtol(optarg, (char **) NULL, 10);
+ ms_setting.nconns= (uint32_t)strtoul(optarg, (char **) NULL, 10);
if (ms_setting.nconns <= 0)
{
fprintf(stderr, "Concurrency must be greater than 0.:-)\n");
{
if (ms_setting.srv_str == NULL)
{
- fprintf(stderr, "No Servers provided.\n\n");
- return -1;
+ char *temp;
+
+ if ((temp= getenv("MEMCACHED_SERVERS")))
+ {
+ ms_setting.srv_str= strdup(temp);
+ }
+ else
+ {
+ fprintf(stderr, "No Servers provided\n\n");
+ return -1;
+ }
}
- if (ms_setting.nconns % ms_setting.nthreads != 0)
+ if (ms_setting.nconns % (uint32_t)ms_setting.nthreads != 0)
{
fprintf(stderr, "Concurrency must be the multiples of threads count.\n");
return -1;
{
/* Wait all the connects complete warm up. */
pthread_mutex_lock(&ms_global.init_lock.lock);
- while (ms_global.init_lock.count < ms_setting.nconns)
+ while (ms_global.init_lock.count < (int)ms_setting.nconns)
{
pthread_cond_wait(&ms_global.init_lock.cond,
&ms_global.init_lock.lock);
* We loop until we know that all connects have cleaned up.
*/
pthread_mutex_lock(&ms_global.run_lock.lock);
- while (ms_global.run_lock.count < ms_setting.nconns)
+ while (ms_global.run_lock.count < (int)ms_setting.nconns)
{
pthread_cond_wait(&ms_global.run_lock.cond, &ms_global.run_lock.lock);
}