projects
/
m6w6
/
libmemcached
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
Made the memcached_string stuff private, but still testable.
[m6w6/libmemcached]
/
clients
/
memslap.c
diff --git
a/clients/memslap.c
b/clients/memslap.c
index 3ed6a2b5a664d15feeca54e015ff9b2eb958a422..47be3c37e63e4dfac8052c002c6e4b3e4d793d22 100644
(file)
--- a/
clients/memslap.c
+++ b/
clients/memslap.c
@@
-13,7
+13,9
@@
* Mingqiang Zhuang <mingqiangzhuang@hengtiansoft.com>
*
*/
* Mingqiang Zhuang <mingqiangzhuang@hengtiansoft.com>
*
*/
+#include <stdlib.h>
#include <getopt.h>
#include <getopt.h>
+#include <limits.h>
#include "ms_sigsegv.h"
#include "ms_setting.h"
#include "ms_sigsegv.h"
#include "ms_setting.h"
@@
-23,56
+25,65
@@
#define PROGRAM_DESCRIPTION \
"Generates workload against memcached servers."
#define PROGRAM_DESCRIPTION \
"Generates workload against memcached servers."
+#ifdef __sun
+ /* For some odd reason the option struct on solaris defines the argument
+ * as char* and not const char*
+ */
+#define OPTIONSTRING char*
+#else
+#define OPTIONSTRING const char*
+#endif
+
/* options */
static struct option long_options[]=
{
/* options */
static struct option long_options[]=
{
- { "servers", required_argument, NULL,
+ {
(OPTIONSTRING)
"servers", required_argument, NULL,
OPT_SERVERS },
OPT_SERVERS },
- { "threads", required_argument, NULL,
+ {
(OPTIONSTRING)
"threads", required_argument, NULL,
OPT_THREAD_NUMBER },
OPT_THREAD_NUMBER },
- { "concurrency", required_argument, NULL,
+ {
(OPTIONSTRING)
"concurrency", required_argument, NULL,
OPT_CONCURRENCY },
OPT_CONCURRENCY },
- { "conn_sock", required_argument, NULL,
+ {
(OPTIONSTRING)
"conn_sock", required_argument, NULL,
OPT_SOCK_PER_CONN },
OPT_SOCK_PER_CONN },
- { "execute_number", required_argument, NULL,
+ {
(OPTIONSTRING)
"execute_number", required_argument, NULL,
OPT_EXECUTE_NUMBER },
OPT_EXECUTE_NUMBER },
- { "time", required_argument, NULL,
+ {
(OPTIONSTRING)
"time", required_argument, NULL,
OPT_TIME },
OPT_TIME },
- { "cfg_cmd", required_argument, NULL,
+ {
(OPTIONSTRING)
"cfg_cmd", required_argument, NULL,
OPT_CONFIG_CMD },
OPT_CONFIG_CMD },
- { "win_size", required_argument, NULL,
+ {
(OPTIONSTRING)
"win_size", required_argument, NULL,
OPT_WINDOW_SIZE },
OPT_WINDOW_SIZE },
- { "fixed_size", required_argument, NULL,
+ {
(OPTIONSTRING)
"fixed_size", required_argument, NULL,
OPT_FIXED_LTH },
OPT_FIXED_LTH },
- { "verify", required_argument, NULL,
+ {
(OPTIONSTRING)
"verify", required_argument, NULL,
OPT_VERIFY },
OPT_VERIFY },
- { "division", required_argument, NULL,
+ {
(OPTIONSTRING)
"division", required_argument, NULL,
OPT_GETS_DIVISION },
OPT_GETS_DIVISION },
- { "stat_freq", required_argument, NULL,
+ {
(OPTIONSTRING)
"stat_freq", required_argument, NULL,
OPT_STAT_FREQ },
OPT_STAT_FREQ },
- { "exp_verify", required_argument, NULL,
+ {
(OPTIONSTRING)
"exp_verify", required_argument, NULL,
OPT_EXPIRE },
OPT_EXPIRE },
- { "overwrite", required_argument, NULL,
+ {
(OPTIONSTRING)
"overwrite", required_argument, NULL,
OPT_OVERWRITE },
OPT_OVERWRITE },
- { "reconnect", no_argument, NULL,
+ {
(OPTIONSTRING)
"reconnect", no_argument, NULL,
OPT_RECONNECT },
OPT_RECONNECT },
- { "udp", no_argument, NULL,
+ {
(OPTIONSTRING)
"udp", no_argument, NULL,
OPT_UDP },
OPT_UDP },
- { "facebook", no_argument, NULL,
+ {
(OPTIONSTRING)
"facebook", no_argument, NULL,
OPT_FACEBOOK_TEST },
OPT_FACEBOOK_TEST },
- { "binary", no_argument, NULL,
+ {
(OPTIONSTRING)
"binary", no_argument, NULL,
OPT_BINARY_PROTOCOL },
OPT_BINARY_PROTOCOL },
- { "tps", required_argument, NULL,
+ {
(OPTIONSTRING)
"tps", required_argument, NULL,
OPT_TPS },
OPT_TPS },
- { "rep_write", required_argument, NULL,
+ {
(OPTIONSTRING)
"rep_write", required_argument, NULL,
OPT_REP_WRITE_SRV },
OPT_REP_WRITE_SRV },
- { "verbose", no_argument, NULL,
+ {
(OPTIONSTRING)
"verbose", no_argument, NULL,
OPT_VERBOSE },
OPT_VERBOSE },
- { "help", no_argument, NULL,
+ {
(OPTIONSTRING)
"help", no_argument, NULL,
OPT_HELP },
OPT_HELP },
- { "version", no_argument, NULL,
+ {
(OPTIONSTRING)
"version", no_argument, NULL,
OPT_VERSION },
OPT_VERSION },
- { 0,
0, 0, 0
},
+ { 0,
0, 0, 0
},
};
/* Prototypes */
};
/* Prototypes */
@@
-153,7
+164,7
@@
static void ms_global_struct_destroy()
*/
static void ms_version_command(const char *command_name)
{
*/
static void ms_version_command(const char *command_name)
{
- printf("%s v%u.%u\n", command_name, 1
, 0
);
+ printf("%s v%u.%u\n", command_name, 1
U, 0U
);
exit(0);
}
exit(0);
}
@@
-276,7
+287,7
@@
void ms_help_command(const char *command_name, const char *description)
{
char *help_message= NULL;
{
char *help_message= NULL;
- printf("%s v%u.%u\n", command_name, 1
, 0
);
+ printf("%s v%u.%u\n", command_name, 1
U, 0U
);
printf(" %s\n\n", description);
printf(
"Usage:\n"
printf(" %s\n\n", description);
printf(
"Usage:\n"
@@
-770,7
+781,8
@@
static void ms_monitor_slap_mode()
second++;
if ((ms_setting.stat_freq > 0) && (second % ms_setting.stat_freq == 0)
second++;
if ((ms_setting.stat_freq > 0) && (second % ms_setting.stat_freq == 0)
- && (ms_stats.active_conns >= ms_setting.nconns))
+ && ((int32_t)ms_stats.active_conns >= ms_setting.nconns)
+ && (ms_stats.active_conns <= (uint32_t)INT_MAX))
{
ms_print_statistics(second);
}
{
ms_print_statistics(second);
}