libmemcached: fix #35 (handling of MEMCACHED_BEHAVIOR_REMOVE_FAILED_SERVERS)
[awesomized/libmemcached] / clients / ms_memslap.h
index 94b53a7858bf5fa7c688b24e42e10b87535f8131..1c1b29ebe7f38163ab84f745aad80710bdb6bc35 100644 (file)
@@ -19,7 +19,9 @@
 #include <unistd.h>
 #include <stdint.h>
 #include <pthread.h>
-#include <stdbool.h>
+#if !defined(__cplusplus)
+# include <stdbool.h>
+#endif
 #include <math.h>
 
 #include "ms_stats.h"
@@ -53,7 +55,7 @@ typedef enum
   OPT_BINARY_PROTOCOL= 'B',
   OPT_OVERWRITE= 'o',
   OPT_TPS= 'P',
-  OPT_REP_WRITE_SRV= 'p',
+  OPT_REP_WRITE_SRV= 'p'
 } ms_options_t;
 
 /* global statistic of response time */
@@ -69,28 +71,28 @@ typedef struct statistic
 /* global status statistic structure */
 typedef struct stats
 {
-  int32_t active_conns;             /* active connections */
-  uint64_t bytes_read;              /* read bytes */
-  uint64_t bytes_written;           /* written bytes */
-  uint64_t obj_bytes;               /* object bytes */
-  uint64_t pre_cmd_get;             /* previous total get command count */
-  uint64_t pre_cmd_set;             /* previous total set command count */
-  uint64_t cmd_get;                 /* current total get command count */
-  uint64_t cmd_set;                 /* current total set command count */
-  uint64_t get_misses;              /* total objects of get miss */
-  uint64_t vef_miss;                /* total objects of verification miss  */
-  uint64_t vef_failed;              /* total objects of verification failed  */
-  uint64_t unexp_unget;             /* total objects which is unexpired but not get */
-  uint64_t exp_get;                 /* total objects which is expired but get  */
-  uint64_t pkt_disorder;            /* disorder packages of UDP */
-  uint64_t pkt_drop;                /* packages dropped of UDP */
-  uint64_t udp_timeout;             /* how many times timeout of UDP happens */
+  volatile uint32_t active_conns;   /* active connections */
+  size_t bytes_read;              /* read bytes */
+  size_t bytes_written;           /* written bytes */
+  size_t obj_bytes;               /* object bytes */
+  size_t pre_cmd_get;             /* previous total get command count */
+  size_t pre_cmd_set;             /* previous total set command count */
+  size_t cmd_get;                 /* current total get command count */
+  size_t cmd_set;                 /* current total set command count */
+  size_t get_misses;              /* total objects of get miss */
+  size_t vef_miss;                /* total objects of verification miss  */
+  size_t vef_failed;              /* total objects of verification failed  */
+  size_t unexp_unget;             /* total objects which is unexpired but not get */
+  size_t exp_get;                 /* total objects which is expired but get  */
+  volatile size_t pkt_disorder;            /* disorder packages of UDP */
+  size_t pkt_drop;                /* packages dropped of UDP */
+  size_t udp_timeout;             /* how many times timeout of UDP happens */
 } ms_stats_t;
 
 /* lock adapter */
 typedef struct sync_lock
 {
-  int count;
+  uint32_t count;
   pthread_mutex_t lock;
   pthread_cond_t cond;
 } ms_sync_lock_t;
@@ -100,6 +102,7 @@ typedef struct global
 {
   /* synchronize lock */
   ms_sync_lock_t init_lock;
+  ms_sync_lock_t warmup_lock;
   ms_sync_lock_t run_lock;
 
   /* mutex for outputing error log synchronously when memslap crashes */