projects
/
m6w6
/
libmemcached
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
|
github
raw
|
patch
|
inline
| side by side (from parent 1:
4408f51
)
Compiles.
author
Brian Aker
<brian@gaz>
Tue, 19 Jan 2010 19:10:54 +0000
(11:10 -0800)
committer
Brian Aker
<brian@gaz>
Tue, 19 Jan 2010 19:10:54 +0000
(11:10 -0800)
clients/memslap.c
patch
|
blob
|
history
clients/ms_conn.c
patch
|
blob
|
history
clients/ms_conn.h
patch
|
blob
|
history
clients/ms_memslap.h
patch
|
blob
|
history
clients/ms_setting.c
patch
|
blob
|
history
clients/ms_setting.h
patch
|
blob
|
history
clients/ms_thread.c
patch
|
blob
|
history
clients/ms_thread.h
patch
|
blob
|
history
diff --git
a/clients/memslap.c
b/clients/memslap.c
index 006d3c2b5d8488f97b249be37e7a3e6cf21250a3..18ac2dd1f2e187074d615bed58b02ea14da4fa17 100644
(file)
--- a/
clients/memslap.c
+++ b/
clients/memslap.c
@@
-456,7
+456,7
@@
static void ms_options_parse(int argc, char *argv[])
break;
case OPT_THREAD_NUMBER: /* --threads or -T */
break;
case OPT_THREAD_NUMBER: /* --threads or -T */
- ms_setting.nthreads= (
int)strto
l(optarg, (char **) NULL, 10);
+ ms_setting.nthreads= (
uint32_t)strtou
l(optarg, (char **) NULL, 10);
if (ms_setting.nthreads <= 0)
{
fprintf(stderr, "Threads number must be greater than 0.:-)\n");
if (ms_setting.nthreads <= 0)
{
fprintf(stderr, "Threads number must be greater than 0.:-)\n");
@@
-572,7
+572,7
@@
static void ms_options_parse(int argc, char *argv[])
break;
case OPT_SOCK_PER_CONN: /* --conn_sock or -n */
break;
case OPT_SOCK_PER_CONN: /* --conn_sock or -n */
- ms_setting.sock_per_conn= (
int)strto
l(optarg, (char **) NULL, 10);
+ ms_setting.sock_per_conn= (
uint32_t)strtou
l(optarg, (char **) NULL, 10);
if (ms_setting.sock_per_conn <= 0)
{
fprintf(stderr, "Number of socks of each concurrency "
if (ms_setting.sock_per_conn <= 0)
{
fprintf(stderr, "Number of socks of each concurrency "
@@
-609,7
+609,7
@@
static void ms_options_parse(int argc, char *argv[])
break;
case OPT_REP_WRITE_SRV: /* --rep_write or -p */
break;
case OPT_REP_WRITE_SRV: /* --rep_write or -p */
- ms_setting.rep_write_srv= (
int)strto
l(optarg, (char **) NULL, 10);
+ ms_setting.rep_write_srv= (
uint32_t)strtou
l(optarg, (char **) NULL, 10);
if (ms_setting.rep_write_srv <= 0)
{
fprintf(stderr,
if (ms_setting.rep_write_srv <= 0)
{
fprintf(stderr,
@@
-792,7
+792,8
@@
static void ms_monitor_slap_mode()
{
/* Wait all the connects complete warm up. */
pthread_mutex_lock(&ms_global.warmup_lock.lock);
{
/* Wait all the connects complete warm up. */
pthread_mutex_lock(&ms_global.warmup_lock.lock);
- while (ms_global.warmup_lock.count < (int)ms_setting.nconns) {
+ while (ms_global.warmup_lock.count < ms_setting.nconns)
+ {
pthread_cond_wait(&ms_global.warmup_lock.cond, &ms_global.warmup_lock.lock);
}
pthread_mutex_unlock(&ms_global.warmup_lock.lock);
pthread_cond_wait(&ms_global.warmup_lock.cond, &ms_global.warmup_lock.lock);
}
pthread_mutex_unlock(&ms_global.warmup_lock.lock);
@@
-839,7
+840,7
@@
static void ms_monitor_slap_mode()
* We loop until we know that all connects have cleaned up.
*/
pthread_mutex_lock(&ms_global.run_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 <
(int)
ms_setting.nconns)
+ while (ms_global.run_lock.count < ms_setting.nconns)
{
pthread_cond_wait(&ms_global.run_lock.cond, &ms_global.run_lock.lock);
}
{
pthread_cond_wait(&ms_global.run_lock.cond, &ms_global.run_lock.lock);
}
diff --git
a/clients/ms_conn.c
b/clients/ms_conn.c
index 32578b3e920323d34547b1d1133b44d30272eb3b..9f92d423c1796093072662d0120ba4cd684af3e3 100644
(file)
--- a/
clients/ms_conn.c
+++ b/
clients/ms_conn.c
@@
-130,8
+130,8
@@
static int ms_transmit(ms_conn_t *c);
static void ms_conn_shrink(ms_conn_t *c);
static void ms_conn_set_state(ms_conn_t *c, int state);
static bool ms_update_event(ms_conn_t *c, const int new_flags);
static void ms_conn_shrink(ms_conn_t *c);
static void ms_conn_set_state(ms_conn_t *c, int state);
static bool ms_update_event(ms_conn_t *c, const int new_flags);
-static
in
t ms_get_rep_sock_index(ms_conn_t *c, int cmd);
-static
in
t ms_get_next_sock_index(ms_conn_t *c);
+static
uint32_
t ms_get_rep_sock_index(ms_conn_t *c, int cmd);
+static
uint32_
t ms_get_next_sock_index(ms_conn_t *c);
static int ms_update_conn_sock_event(ms_conn_t *c);
static bool ms_need_yield(ms_conn_t *c);
static void ms_update_start_time(ms_conn_t *c);
static int ms_update_conn_sock_event(ms_conn_t *c);
static bool ms_need_yield(ms_conn_t *c);
static void ms_update_start_time(ms_conn_t *c);
@@
-473,9
+473,9
@@
static int ms_item_win_init(ms_conn_t *c)
static int ms_conn_sock_init(ms_conn_t *c)
{
ms_thread_t *ms_thread= pthread_getspecific(ms_thread_key);
static int ms_conn_sock_init(ms_conn_t *c)
{
ms_thread_t *ms_thread= pthread_getspecific(ms_thread_key);
-
in
t i;
+
uint32_
t i;
int ret_sfd;
int ret_sfd;
-
in
t srv_idx= 0;
+
uint32_
t srv_idx= 0;
assert(c != NULL);
assert(c->tcpsfd != NULL);
assert(c != NULL);
assert(c->tcpsfd != NULL);
@@
-538,7
+538,7
@@
static int ms_conn_sock_init(ms_conn_t *c)
}
else
{
}
else
{
- for (
in
t j= 0; j < i; j++)
+ for (
uint32_
t j= 0; j < i; j++)
{
close(c->tcpsfd[j]);
}
{
close(c->tcpsfd[j]);
}
@@
-668,7
+668,7
@@
static void ms_conn_close(ms_conn_t *c)
/* delete the event, the socket and the connection */
event_del(&c->event);
/* delete the event, the socket and the connection */
event_del(&c->event);
- for (
in
t i= 0; i < c->total_sfds; i++)
+ for (
uint32_
t i= 0; i < c->total_sfds; i++)
{
if (c->tcpsfd[i] > 0)
{
{
if (c->tcpsfd[i] > 0)
{
@@
-894,18
+894,18
@@
static int ms_network_connect(ms_conn_t *c,
static int ms_reconn(ms_conn_t *c)
{
ms_thread_t *ms_thread= pthread_getspecific(ms_thread_key);
static int ms_reconn(ms_conn_t *c)
{
ms_thread_t *ms_thread= pthread_getspecific(ms_thread_key);
-
in
t srv_idx= 0;
- int32_t srv_conn_cnt= 0;
+
uint32_
t srv_idx= 0;
+
u
int32_t srv_conn_cnt= 0;
if (ms_setting.rep_write_srv > 0)
{
srv_idx= c->cur_idx % ms_setting.srv_cnt;
if (ms_setting.rep_write_srv > 0)
{
srv_idx= c->cur_idx % ms_setting.srv_cnt;
- srv_conn_cnt=
(int)(ms_setting.sock_per_conn * ms_setting.nconns)
;
+ srv_conn_cnt=
ms_setting.sock_per_conn * ms_setting.nconns
;
}
else
{
srv_idx= ms_thread->thread_ctx->srv_idx;
}
else
{
srv_idx= ms_thread->thread_ctx->srv_idx;
- srv_conn_cnt=
(int32_t)((int)ms_setting.nconns / ms_setting.srv_cnt)
;
+ srv_conn_cnt=
ms_setting.nconns / ms_setting.srv_cnt
;
}
/* close the old socket handler */
}
/* close the old socket handler */
@@
-913,7
+913,7
@@
static int ms_reconn(ms_conn_t *c)
c->tcpsfd[c->cur_idx]= 0;
if (atomic_add_32_nv(&ms_setting.servers[srv_idx].disconn_cnt, 1)
c->tcpsfd[c->cur_idx]= 0;
if (atomic_add_32_nv(&ms_setting.servers[srv_idx].disconn_cnt, 1)
- %
(uint32_t)
srv_conn_cnt == 0)
+ % srv_conn_cnt == 0)
{
gettimeofday(&ms_setting.servers[srv_idx].disconn_time, NULL);
fprintf(stderr, "Server %s:%d disconnect\n",
{
gettimeofday(&ms_setting.servers[srv_idx].disconn_time, NULL);
fprintf(stderr, "Server %s:%d disconnect\n",
@@
-923,7
+923,8
@@
static int ms_reconn(ms_conn_t *c)
if (ms_setting.rep_write_srv > 0)
{
if (ms_setting.rep_write_srv > 0)
{
- int i= 0;
+ uint32_t i= 0;
+
for (i= 0; i < c->total_sfds; i++)
{
if (c->tcpsfd[i] != 0)
for (i= 0; i < c->total_sfds; i++)
{
if (c->tcpsfd[i] != 0)
@@
-995,9
+996,9
@@
static int ms_reconn(ms_conn_t *c)
int ms_reconn_socks(ms_conn_t *c)
{
ms_thread_t *ms_thread= pthread_getspecific(ms_thread_key);
int ms_reconn_socks(ms_conn_t *c)
{
ms_thread_t *ms_thread= pthread_getspecific(ms_thread_key);
-
in
t srv_idx= 0;
+
uint32_
t srv_idx= 0;
int ret_sfd= 0;
int ret_sfd= 0;
-
in
t srv_conn_cnt= 0;
+
uint32_
t srv_conn_cnt= 0;
struct timeval cur_time;
assert(c != NULL);
struct timeval cur_time;
assert(c != NULL);
@@
-1007,7
+1008,7
@@
int ms_reconn_socks(ms_conn_t *c)
return 0;
}
return 0;
}
- for (
in
t i= 0; i < c->total_sfds; i++)
+ for (
uint32_
t i= 0; i < c->total_sfds; i++)
{
if (c->tcpsfd[i] == 0)
{
{
if (c->tcpsfd[i] == 0)
{
@@
-1028,12
+1029,12
@@
int ms_reconn_socks(ms_conn_t *c)
if (ms_setting.rep_write_srv > 0)
{
srv_idx= i % ms_setting.srv_cnt;
if (ms_setting.rep_write_srv > 0)
{
srv_idx= i % ms_setting.srv_cnt;
- srv_conn_cnt=
(int)(ms_setting.sock_per_conn * ms_setting.nconns)
;
+ srv_conn_cnt=
ms_setting.sock_per_conn * ms_setting.nconns
;
}
else
{
srv_idx= ms_thread->thread_ctx->srv_idx;
}
else
{
srv_idx= ms_thread->thread_ctx->srv_idx;
- srv_conn_cnt=
(int)
ms_setting.nconns / ms_setting.srv_cnt;
+ srv_conn_cnt= ms_setting.nconns / ms_setting.srv_cnt;
}
if (ms_network_connect(c, ms_setting.servers[srv_idx].srv_host_name,
}
if (ms_network_connect(c, ms_setting.servers[srv_idx].srv_host_name,
@@
-2721,10
+2722,10
@@
void ms_event_handler(const int fd, const short which, void *arg)
*
* @return int, if success, return the index, else return 0
*/
*
* @return int, if success, return the index, else return 0
*/
-static
in
t ms_get_rep_sock_index(ms_conn_t *c, int cmd)
+static
uint32_
t ms_get_rep_sock_index(ms_conn_t *c, int cmd)
{
{
-
int sock_index= -1
;
-
in
t i= 0;
+
uint32_t sock_index= 0
;
+
uint32_
t i= 0;
if (c->total_sfds == 1)
{
if (c->total_sfds == 1)
{
@@
-2751,18
+2752,18
@@
static int ms_get_rep_sock_index(ms_conn_t *c, int cmd)
if (i == ms_setting.rep_write_srv)
{
/* random get one replication server to read */
if (i == ms_setting.rep_write_srv)
{
/* random get one replication server to read */
- sock_index= (
in
t)(random() % c->total_sfds);
+ sock_index= (
uint32_
t)(random() % c->total_sfds);
}
else
{
/* random get one replication writing server to write */
}
else
{
/* random get one replication writing server to write */
- sock_index= (
in
t)(random() % ms_setting.rep_write_srv);
+ sock_index= (
uint32_
t)(random() % ms_setting.rep_write_srv);
}
}
else if (cmd == CMD_GET)
{
/* random get one replication server to read */
}
}
else if (cmd == CMD_GET)
{
/* random get one replication server to read */
- sock_index= (
in
t)(random() % c->total_sfds);
+ sock_index= (
uint32_
t)(random() % c->total_sfds);
}
}
while (c->tcpsfd[sock_index] == 0);
}
}
while (c->tcpsfd[sock_index] == 0);
@@
-2778,9
+2779,9
@@
static int ms_get_rep_sock_index(ms_conn_t *c, int cmd)
*
* @return int, return the index
*/
*
* @return int, return the index
*/
-static
in
t ms_get_next_sock_index(ms_conn_t *c)
+static
uint32_
t ms_get_next_sock_index(ms_conn_t *c)
{
{
-
in
t sock_index= 0;
+
uint32_
t sock_index= 0;
do
{
do
{
diff --git
a/clients/ms_conn.h
b/clients/ms_conn.h
index a52a55c95ec62a6f3685e0a394ac092de27be49d..cf1e8c0fc9c71dace61c4e10aab87a4dc7cb7b71 100644
(file)
--- a/
clients/ms_conn.h
+++ b/
clients/ms_conn.h
@@
-117,7
+117,7
@@
enum protocol
*/
typedef struct conn
{
*/
typedef struct conn
{
-
in
t conn_idx; /* connection index in the thread */
+
uint32_
t conn_idx; /* connection index in the thread */
int sfd; /* current tcp sock handler of the connection structure */
int udpsfd; /* current udp sock handler of the connection structure*/
int state; /* state of the connection */
int sfd; /* current tcp sock handler of the connection structure */
int udpsfd; /* current udp sock handler of the connection structure*/
int state; /* state of the connection */
@@
-127,9
+127,9
@@
typedef struct conn
bool change_sfd; /* whether change sfd */
int *tcpsfd; /* TCP sock array */
bool change_sfd; /* whether change sfd */
int *tcpsfd; /* TCP sock array */
-
in
t total_sfds; /* how many socks in the tcpsfd array */
-
in
t alive_sfds; /* alive socks */
-
in
t cur_idx; /* current sock index in tcpsfd array */
+
uint32_
t total_sfds; /* how many socks in the tcpsfd array */
+
uint32_
t alive_sfds; /* alive socks */
+
uint32_
t cur_idx; /* current sock index in tcpsfd array */
ms_cmdstat_t precmd; /* previous command state */
ms_cmdstat_t currcmd; /* current command state */
ms_cmdstat_t precmd; /* previous command state */
ms_cmdstat_t currcmd; /* current command state */
@@
-159,7
+159,7
@@
typedef struct conn
int msgbytes; /* number of bytes in current msg */
/* data for UDP clients */
int msgbytes; /* number of bytes in current msg */
/* data for UDP clients */
-
int
udp; /* is this is a UDP "connection" */
+
bool
udp; /* is this is a UDP "connection" */
uint32_t request_id; /* UDP request ID of current operation, if this is a UDP "connection" */
uint8_t *hdrbuf; /* udp packet headers */
int hdrsize; /* number of headers' worth of space is allocated */
uint32_t request_id; /* UDP request ID of current operation, if this is a UDP "connection" */
uint8_t *hdrbuf; /* udp packet headers */
int hdrsize; /* number of headers' worth of space is allocated */
diff --git
a/clients/ms_memslap.h
b/clients/ms_memslap.h
index 540fed0e16c218aa3f6ffe015852df4a491aab00..dc0844d82ff2496eb03ca86a61fea5f59d9784cd 100644
(file)
--- a/
clients/ms_memslap.h
+++ b/
clients/ms_memslap.h
@@
-92,7
+92,7
@@
typedef struct stats
/* lock adapter */
typedef struct sync_lock
{
/* lock adapter */
typedef struct sync_lock
{
-
in
t count;
+
uint32_
t count;
pthread_mutex_t lock;
pthread_cond_t cond;
} ms_sync_lock_t;
pthread_mutex_t lock;
pthread_cond_t cond;
} ms_sync_lock_t;
diff --git
a/clients/ms_setting.c
b/clients/ms_setting.c
index eb5e40557ba512149a334d65ad9ea368a6668ed3..ac76853fbb1289192dc88e05aa5a2ae4843a1149 100644
(file)
--- a/
clients/ms_setting.c
+++ b/
clients/ms_setting.c
@@
-54,7
+54,7
@@
ms_setting_st ms_setting; /* store the settings specified by user */
/* read setting from configuration file */
static void ms_get_serverlist(char *str);
/* read setting from configuration file */
static void ms_get_serverlist(char *str);
-static
in
t ms_get_cpu_count(void);
+static
uint32_
t ms_get_cpu_count(void);
ms_conf_type_t ms_get_conf_type(char *line);
static int ms_is_line_data(char *line);
static int ms_read_is_data(char *line, ssize_t nread);
ms_conf_type_t ms_get_conf_type(char *line);
static int ms_is_line_data(char *line);
static int ms_read_is_data(char *line, ssize_t nread);
@@
-198,7
+198,7
@@
static void ms_get_serverlist(char *str)
*
* @return return the cpu count if get, else return 1
*/
*
* @return return the cpu count if get, else return 1
*/
-static
in
t ms_get_cpu_count()
+static
uint32_
t ms_get_cpu_count()
{
#ifdef HAVE__SC_NPROCESSORS_ONLN
return sysconf(_SC_NPROCESSORS_CONF);
{
#ifdef HAVE__SC_NPROCESSORS_ONLN
return sysconf(_SC_NPROCESSORS_CONF);
diff --git
a/clients/ms_setting.h
b/clients/ms_setting.h
index f558dd32fe837214b7971d8c0a51803a0f80782c..d8ccf8bbf42a753730c2bc8b0beffba3664a571c 100644
(file)
--- a/
clients/ms_setting.h
+++ b/
clients/ms_setting.h
@@
-110,8
+110,8
@@
typedef struct cmd_distr
/* global setting structure */
typedef struct setting
{
/* global setting structure */
typedef struct setting
{
-
in
t ncpu; /* cpu count of this system */
-
in
t nthreads; /* total thread count, must equal or less than cpu cores */
+
uint32_
t ncpu; /* cpu count of this system */
+
uint32_
t nthreads; /* total thread count, must equal or less than cpu cores */
uint32_t nconns; /* total conn count, must multiply by total thread count */
int64_t exec_num; /* total execute number */
int run_time; /* total run time */
uint32_t nconns; /* total conn count, must multiply by total thread count */
int64_t exec_num; /* total execute number */
int run_time; /* total run time */
@@
-124,8
+124,8
@@
typedef struct setting
char *cfg_file; /* configure file name */
ms_mcd_server_t *servers; /* servers array */
char *cfg_file; /* configure file name */
ms_mcd_server_t *servers; /* servers array */
-
in
t total_srv_cnt; /* total servers count of the servers array */
-
in
t srv_cnt; /* servers count */
+
uint32_
t total_srv_cnt; /* total servers count of the servers array */
+
uint32_
t srv_cnt; /* servers count */
ms_key_distr_t *key_distr; /* array of key distribution */
int total_key_rng_cnt; /* total key range count of the array */
ms_key_distr_t *key_distr; /* array of key distribution */
int total_key_rng_cnt; /* total key range count of the array */
@@
-152,10
+152,10
@@
typedef struct setting
bool reconnect; /* whether it reconnect when connection close */
bool verbose; /* whether it outputs detailed information when verification */
bool facebook_test; /* facebook test, TCP set and multi-get with UDP */
bool reconnect; /* whether it reconnect when connection close */
bool verbose; /* whether it outputs detailed information when verification */
bool facebook_test; /* facebook test, TCP set and multi-get with UDP */
-
in
t sock_per_conn; /* number of socks per connection structure */
+
uint32_
t sock_per_conn; /* number of socks per connection structure */
bool binary_prot; /* whether it use binary protocol */
int expected_tps; /* expected throughput */
bool binary_prot; /* whether it use binary protocol */
int expected_tps; /* expected throughput */
-
in
t rep_write_srv; /* which servers are used to do replication writing */
+
uint32_
t rep_write_srv; /* which servers are used to do replication writing */
} ms_setting_st;
extern ms_setting_st ms_setting;
} ms_setting_st;
extern ms_setting_st ms_setting;
diff --git
a/clients/ms_thread.c
b/clients/ms_thread.c
index 60f8ef7947a2860a9b92b8d670da0f4f8364efef..299412a19488e01809d749aaf75872fc0e9a8ade 100644
(file)
--- a/
clients/ms_thread.c
+++ b/
clients/ms_thread.c
@@
-35,7
+35,7
@@
static ms_thread_ctx_t *ms_thread_ctx;
static void ms_set_current_time(void);
static void ms_check_sock_timeout(void);
static void ms_clock_handler(const int fd, const short which, void *arg);
static void ms_set_current_time(void);
static void ms_check_sock_timeout(void);
static void ms_clock_handler(const int fd, const short which, void *arg);
-static
int ms_set_thread_cpu_affinity(in
t cpu);
+static
uint32_t ms_set_thread_cpu_affinity(uint32_
t cpu);
static int ms_setup_thread(ms_thread_ctx_t *thread_ctx);
static void *ms_worker_libevent(void *arg);
static void ms_create_worker(void *(*func)(void *), void *arg);
static int ms_setup_thread(ms_thread_ctx_t *thread_ctx);
static void *ms_worker_libevent(void *arg);
static void ms_create_worker(void *(*func)(void *), void *arg);
@@
-65,7
+65,7
@@
static void ms_check_sock_timeout(void)
ms_conn_t *c= NULL;
int time_diff= 0;
ms_conn_t *c= NULL;
int time_diff= 0;
- for (
in
t i= 0; i < ms_thread->thread_ctx->nconns; i++)
+ for (
uint32_
t i= 0; i < ms_thread->thread_ctx->nconns; i++)
{
c= &ms_thread->conn[i];
{
c= &ms_thread->conn[i];
@@
-94,7
+94,7
@@
static void ms_check_sock_timeout(void)
static void ms_reconn_thread_socks(void)
{
ms_thread_t *ms_thread= pthread_getspecific(ms_thread_key);
static void ms_reconn_thread_socks(void)
{
ms_thread_t *ms_thread= pthread_getspecific(ms_thread_key);
- for (
in
t i= 0; i < ms_thread->thread_ctx->nconns; i++)
+ for (
uint32_
t i= 0; i < ms_thread->thread_ctx->nconns; i++)
{
ms_reconn_socks(&ms_thread->conn[i]);
}
{
ms_reconn_socks(&ms_thread->conn[i]);
}
@@
-148,9
+148,9
@@
static void ms_clock_handler(const int fd, const short which, void *arg)
*
* @return if success, return 0, else return -1
*/
*
* @return if success, return 0, else return -1
*/
-static
int ms_set_thread_cpu_affinity(in
t cpu)
+static
uint32_t ms_set_thread_cpu_affinity(uint32_
t cpu)
{
{
-
in
t ret= 0;
+
uint32_
t ret= 0;
#ifdef HAVE_CPU_SET_T
cpu_set_t cpu_set;
#ifdef HAVE_CPU_SET_T
cpu_set_t cpu_set;
@@
-216,7
+216,7
@@
static int ms_setup_thread(ms_thread_ctx_t *thread_ctx)
}
memset(ms_thread->conn, 0, (size_t)thread_ctx->nconns * sizeof(ms_conn_t));
}
memset(ms_thread->conn, 0, (size_t)thread_ctx->nconns * sizeof(ms_conn_t));
- for (
in
t i= 0; i < thread_ctx->nconns; i++)
+ for (
uint32_
t i= 0; i < thread_ctx->nconns; i++)
{
ms_thread->conn[i].conn_idx= i;
if (ms_setup_conn(&ms_thread->conn[i]) != 0)
{
ms_thread->conn[i].conn_idx= i;
if (ms_setup_conn(&ms_thread->conn[i]) != 0)
@@
-310,10
+310,10
@@
void ms_thread_init()
exit(1);
}
exit(1);
}
- for (
in
t i= 0; i < ms_setting.nthreads; i++)
+ for (
uint32_
t i= 0; i < ms_setting.nthreads; i++)
{
ms_thread_ctx[i].thd_idx= i;
{
ms_thread_ctx[i].thd_idx= i;
- ms_thread_ctx[i].nconns=
(int)((int)ms_setting.nconns / ms_setting.nthreads)
;
+ ms_thread_ctx[i].nconns=
ms_setting.nconns / ms_setting.nthreads
;
/**
* If only one server, all the connections in all threads
/**
* If only one server, all the connections in all threads
@@
-333,7
+333,7
@@
void ms_thread_init()
exit(1);
}
/* Create threads after we've done all the epoll setup. */
exit(1);
}
/* Create threads after we've done all the epoll setup. */
- for (
in
t i= 0; i < ms_setting.nthreads; i++)
+ for (
uint32_
t i= 0; i < ms_setting.nthreads; i++)
{
ms_create_worker(ms_worker_libevent, (void *)&ms_thread_ctx[i]);
}
{
ms_create_worker(ms_worker_libevent, (void *)&ms_thread_ctx[i]);
}
diff --git
a/clients/ms_thread.h
b/clients/ms_thread.h
index 3eea256343c0dd9ef636bdd43baa33aefee27e0e..8cb98bde97461c6ceb9b6d32668e0df5b5463516 100644
(file)
--- a/
clients/ms_thread.h
+++ b/
clients/ms_thread.h
@@
-40,9
+40,9
@@
typedef unsigned int rel_time_t;
/* Used to store the context of each thread */
typedef struct thread_ctx
{
/* Used to store the context of each thread */
typedef struct thread_ctx
{
-
in
t thd_idx; /* the thread index */
-
in
t nconns; /* how many connections included by the thread */
-
in
t srv_idx; /* index of the thread */
+
uint32_
t thd_idx; /* the thread index */
+
uint32_
t nconns; /* how many connections included by the thread */
+
uint32_
t srv_idx; /* index of the thread */
int tps_perconn; /* expected throughput per connection */
int64_t exec_num_perconn; /* execute number per connection */
} ms_thread_ctx_t;
int tps_perconn; /* expected throughput per connection */
int64_t exec_num_perconn; /* execute number per connection */
} ms_thread_ctx_t;
@@
-51,7
+51,7
@@
typedef struct thread_ctx
typedef struct thread
{
ms_conn_t *conn; /* conn array to store all the conn in the thread */
typedef struct thread
{
ms_conn_t *conn; /* conn array to store all the conn in the thread */
-
in
t nactive_conn; /* how many connects are active */
+
uint32_
t nactive_conn; /* how many connects are active */
ms_thread_ctx_t *thread_ctx; /* thread context from the caller */
struct event_base *base; /* libevent handler created by this thread */
ms_thread_ctx_t *thread_ctx; /* thread context from the caller */
struct event_base *base; /* libevent handler created by this thread */