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.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);
}
if (ms_setting.rep_write_srv > 0)
{
srv_idx= c->cur_idx;
- srv_conn_cnt= ms_setting.nconns;
+ srv_conn_cnt= (int)ms_setting.nconns;
}
else
{
srv_idx= ms_thread->thread_ctx->srv_idx;
- srv_conn_cnt= ms_setting.nconns / ms_setting.srv_cnt;
+ srv_conn_cnt= (int32_t)((int)ms_setting.nconns / ms_setting.srv_cnt);
}
/* close the old socket handler */
if (ms_setting.rep_write_srv > 0)
{
srv_idx= i;
- srv_conn_cnt= ms_setting.nconns;
+ srv_conn_cnt= (int)ms_setting.nconns;
}
else
{
srv_idx= ms_thread->thread_ctx->srv_idx;
- srv_conn_cnt= ms_setting.nconns / ms_setting.srv_cnt;
+ srv_conn_cnt= (int)ms_setting.nconns / ms_setting.srv_cnt;
}
if (ms_network_connect(c, ms_setting.servers[srv_idx].srv_host_name,
/* global status statistic structure */
typedef struct stats
{
- volatile int32_t active_conns; /* active connections */
+ 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 */
{
int ncpu; /* cpu count of this system */
int nthreads; /* total thread count, must equal or less than cpu cores */
- int nconns; /* total conn count, must multiply by total thread count */
+ 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 */
for (int i= 0; i < ms_setting.nthreads; i++)
{
ms_thread_ctx[i].thd_idx= i;
- ms_thread_ctx[i].nconns= ms_setting.nconns / ms_setting.nthreads;
+ ms_thread_ctx[i].nconns= (int)((int)ms_setting.nconns / ms_setting.nthreads);
/**
* If only one server, all the connections in all threads
*/
ms_thread_ctx[i].srv_idx= i % ms_setting.srv_cnt;
ms_thread_ctx[i].tps_perconn= ms_setting.expected_tps
- / ms_setting.nconns;
+ / (int)ms_setting.nconns;
ms_thread_ctx[i].exec_num_perconn= ms_setting.exec_num
/ ms_setting.nconns;
}