3 * Author: Mingqiang Zhuang
5 * Created on February 10, 2009
7 * (c) Copyright 2009, Schooner Information Technology, Inc.
8 * http://www.schoonerinfotech.com/
22 #if !defined(__cplusplus)
28 #include "ms_atomic.h"
34 /* command line option */
41 OPT_EXECUTE_NUMBER
= 'x',
42 OPT_THREAD_NUMBER
= 'T',
46 OPT_GETS_DIVISION
= 'd',
54 OPT_FACEBOOK_TEST
= 'a',
55 OPT_SOCK_PER_CONN
= 'n',
56 OPT_BINARY_PROTOCOL
= 'B',
59 OPT_REP_WRITE_SRV
= 'p'
62 /* global statistic of response time */
63 typedef struct statistic
65 pthread_mutex_t stat_mutex
; /* synchronize the following members */
67 ms_stat_t get_stat
; /* statistics of get command */
68 ms_stat_t set_stat
; /* statistics of set command */
69 ms_stat_t total_stat
; /* statistics of both get and set commands */
72 /* global status statistic structure */
75 ATOMIC
uint32_t active_conns
; /* active connections */
76 ATOMIC
size_t bytes_read
; /* read bytes */
77 ATOMIC
size_t bytes_written
; /* written bytes */
78 ATOMIC
size_t obj_bytes
; /* object bytes */
79 ATOMIC
size_t pre_cmd_get
; /* previous total get command count */
80 ATOMIC
size_t pre_cmd_set
; /* previous total set command count */
81 ATOMIC
size_t cmd_get
; /* current total get command count */
82 ATOMIC
size_t cmd_set
; /* current total set command count */
83 ATOMIC
size_t get_misses
; /* total objects of get miss */
84 ATOMIC
size_t vef_miss
; /* total objects of verification miss */
85 ATOMIC
size_t vef_failed
; /* total objects of verification failed */
86 ATOMIC
size_t unexp_unget
; /* total objects which is unexpired but not get */
87 ATOMIC
size_t exp_get
; /* total objects which is expired but get */
88 ATOMIC
size_t pkt_disorder
; /* disorder packages of UDP */
89 ATOMIC
size_t pkt_drop
; /* packages dropped of UDP */
90 ATOMIC
size_t udp_timeout
; /* how many times timeout of UDP happens */
94 typedef struct sync_lock
101 /* global variable structure */
102 typedef struct global
104 /* synchronize lock */
105 ms_sync_lock_t init_lock
;
106 ms_sync_lock_t warmup_lock
;
107 ms_sync_lock_t run_lock
;
109 /* mutex for outputing error log synchronously when memslap crashes */
110 pthread_mutex_t quit_mutex
;
112 /* mutex for generating key prefix */
113 pthread_mutex_t seq_mutex
;
115 /* global synchronous flags for slap mode */
120 /* global structure */
121 ms_global_t ms_global
;
123 /* global stats information structure */
126 /* global statistic structure */
127 ms_statistic_t ms_statistic
;
133 #endif /* end of MS_MEMSLAP_H */