break;
case OPT_BINARY_PROTOCOL: /* --binary or -B */
- ms_setting.binary_prot= true;
+ ms_setting.binary_prot_= true;
break;
case OPT_TPS: /* --tps or -P */
/* the loop of the main thread, wait the work threads to complete */
static void ms_monitor_slap_mode()
{
- int second= 0;
struct timeval start_time, end_time;
/* Wait all the threads complete initialization. */
/* running in "run time" mode, user specify run time */
if (ms_setting.run_time > 0)
{
+ int second= 0;
gettimeofday(&start_time, NULL);
while (1)
{
if ((file_buffer_ptr= (char *)malloc(sizeof(char) * (size_t)sbuf.st_size)) == NULL)
{
std::cerr << "Error allocating file buffer(" << strerror(errno) << ")" << std::endl;
+ close(fd);
exit(EXIT_FAILURE);
}
if ((read_length= ::read(fd, file_buffer_ptr, (size_t)sbuf.st_size)) == -1)
{
std::cerr << "Error while reading file " << file_buffer_ptr << " (" << strerror(errno) << ")" << std::endl;
+ close(fd);
exit(EXIT_FAILURE);
}
if (read_length != sbuf.st_size)
{
std::cerr << "Failure while reading file. Read length was not equal to stat() length" << std::endl;
+ close(fd);
exit(EXIT_FAILURE);
}
c->mlget_task.mlget_num= 0;
c->mlget_task.value_index= -1; /* default invalid value */
- if (ms_setting.binary_prot)
+ if (ms_setting.binary_prot_)
{
c->protocol= binary_prot;
}
exit(1);
}
- if (! ms_setting.binary_prot
+ if (! ms_setting.binary_prot_
&& ((start_len > MAX_KEY_SIZE) || (end_len > MAX_KEY_SIZE)))
{
fprintf(stderr, "key length must be less than 250 bytes.\n");
ms_setting.reconnect= false;
ms_setting.verbose= false;
ms_setting.facebook_test= false;
- ms_setting.binary_prot= false;
+ ms_setting.binary_prot_= false;
ms_setting.stat_freq= 0;
ms_setting.srv_str= NULL;
ms_setting.cfg_file= NULL;
bool verbose; /* whether it outputs detailed information when verification */
bool facebook_test; /* facebook test, TCP set and multi-get with UDP */
uint32_t sock_per_conn; /* number of socks per connection structure */
- bool binary_prot; /* whether it use binary protocol */
+ bool binary_prot_; /* whether it use binary protocol */
int expected_tps; /* expected throughput */
uint32_t rep_write_srv; /* which servers are used to do replication writing */
} ms_setting_st;
double global_std= 0;
double global_log= 0;
- uint64_t diff_time= 0;
- uint64_t diff_events= 0;
- double diff_squares= 0;
- double diff_log_product= 0;
double period_average= 0;
uint64_t period_tps= 0;
double period_rate= 0;
* global_average) / (double)(events - 1));
global_log= exp(stat->log_product / (double)events);
- diff_time= stat->total_time - stat->pre_total_time;
- diff_events= events - stat->pre_events;
+ uint64_t diff_time= stat->total_time - stat->pre_total_time;
+ uint64_t diff_events= events - stat->pre_events;
if (diff_events >= 1)
{
period_average= (double)(diff_time / diff_events);
period_tps= diff_events / (uint64_t)freq;
period_rate= (double)diff_events * obj_size / 1024 / 1024 / freq;
- diff_squares= (double)stat->squares - (double)stat->pre_squares;
+ double diff_squares= (double)stat->squares - (double)stat->pre_squares;
period_std= sqrt((diff_squares - (double)diff_events * period_average
* period_average) / (double)(diff_events - 1));
- diff_log_product= stat->log_product - stat->pre_log_product;
+ double diff_log_product= stat->log_product - stat->pre_log_product;
period_log= exp(diff_log_product / (double)diff_events);
}
WATCHPOINT_ASSERT(ptr->fd != INVALID_SOCKET);
WATCHPOINT_ASSERT(write_length > 0);
- int flags= with_flush ? MSG_NOSIGNAL|MSG_DONTWAIT : MSG_NOSIGNAL|MSG_DONTWAIT|MSG_MORE;
+ int flags;
+ if (with_flush)
+ {
+ flags= MSG_NOSIGNAL|MSG_DONTWAIT;
+ }
+ else
+ {
+ flags= MSG_NOSIGNAL|MSG_DONTWAIT|MSG_MORE;
+ }
+
ssize_t sent_length= ::send(ptr->fd, local_write_ptr, write_length, flags);
if (sent_length == SOCKET_ERROR)
#if 0
*error= memcached_set_errno(*ptr, MEMCACHED_MEMORY_ALLOCATION_FAILURE, MEMCACHED_AT);
#endif
+ free(new_host_list);
return NULL;
}
{
for (libtest::vchar_ptr_t::iterator iter= _keys.begin();
iter != _keys.end();
- iter++)
+ ++iter)
{
::free(*iter);
}
else
{
// Assume a minimum of 3, and a maximum of 8
- world->servers().set_servers_to_run(libtest::number_of_cpus() > 3 ?
+ world->servers().set_servers_to_run((libtest::number_of_cpus() > 3) ?
std::min(libtest::number_of_cpus(), size_t(8)) : 3);
}
for (libtest::vchar_ptr_t::iterator iter= keys.begin();
iter != keys.end();
- iter++)
+ ++iter)
{
test_compare_hint(MEMCACHED_SUCCESS,
memcached_set(memc,