@@ -471,8 +471,12 @@ void client::create_request(void)
471471 // are we set or get? this depends on the ratio
472472 if (m_set_ratio_count < m_config->ratio .a ) {
473473 // set command
474-
475- data_object *obj = m_obj_gen->get_object (m_config->key_pattern [0 ] == ' R' ? 0 : 1 );
474+ int iter = OBJECT_GENERATOR_KEY_SET_ITER;
475+ if (m_config->key_pattern [0 ] == ' R' )
476+ iter = OBJECT_GENERATOR_KEY_RANDOM;
477+ else if (m_config->key_pattern [0 ] == ' G' )
478+ iter = OBJECT_GENERATOR_KEY_GAUSSIAN;
479+ data_object *obj = m_obj_gen->get_object (iter);
476480 unsigned int key_len;
477481 const char *key = obj->get_key (&key_len);
478482 unsigned int value_len;
@@ -483,7 +487,7 @@ void client::create_request(void)
483487 benchmark_debug_log (" SET key=[%.*s] value_len=%u expiry=%u\n " ,
484488 key_len, key, value_len, obj->get_expiry ());
485489 cmd_size = m_protocol->write_command_set (key, key_len, value, value_len,
486- obj->get_expiry ());
490+ obj->get_expiry (), m_config-> data_offset );
487491
488492 m_pipeline.push (new client::request (rt_set, cmd_size, NULL , 1 ));
489493 } else if (m_get_ratio_count < m_config->ratio .b ) {
@@ -500,7 +504,12 @@ void client::create_request(void)
500504 m_keylist->clear ();
501505 while (m_keylist->get_keys_count () < keys_count) {
502506 unsigned int keylen;
503- const char *key = m_obj_gen->get_key (m_config->key_pattern [2 ] == ' R' ? 0 : 2 , &keylen);
507+ int iter = OBJECT_GENERATOR_KEY_GET_ITER;
508+ if (m_config->key_pattern [2 ] == ' R' )
509+ iter = OBJECT_GENERATOR_KEY_RANDOM;
510+ else if (m_config->key_pattern [2 ] == ' G' )
511+ iter = OBJECT_GENERATOR_KEY_GAUSSIAN;
512+ const char *key = m_obj_gen->get_key (iter, &keylen);
504513
505514 assert (key != NULL );
506515 assert (keylen > 0 );
@@ -521,12 +530,17 @@ void client::create_request(void)
521530 m_pipeline.push (new client::request (rt_get, cmd_size, NULL , m_keylist->get_keys_count ()));
522531 } else {
523532 unsigned int keylen;
524- const char *key = m_obj_gen->get_key (m_config->key_pattern [2 ] == ' R' ? 0 : 2 , &keylen);
533+ int iter = OBJECT_GENERATOR_KEY_GET_ITER;
534+ if (m_config->key_pattern [2 ] == ' R' )
535+ iter = OBJECT_GENERATOR_KEY_RANDOM;
536+ else if (m_config->key_pattern [2 ] == ' G' )
537+ iter = OBJECT_GENERATOR_KEY_GAUSSIAN;
538+ const char *key = m_obj_gen->get_key (iter, &keylen);
525539 assert (key != NULL );
526540 assert (keylen > 0 );
527541
528542 benchmark_debug_log (" GET key=[%.*s]\n " , keylen, key);
529- cmd_size = m_protocol->write_command_get (key, keylen);
543+ cmd_size = m_protocol->write_command_get (key, keylen, m_config-> data_offset );
530544
531545 m_get_ratio_count++;
532546 m_pipeline.push (new client::request (rt_get, cmd_size, NULL , 1 ));
@@ -734,15 +748,20 @@ void verify_client::create_request(void)
734748 if (m_set_ratio_count < m_config->ratio .a ) {
735749 // Prepare a GET request that will be compared against a previous
736750 // SET request.
737- data_object *obj = m_obj_gen->get_object (m_config->key_pattern [0 ] == ' R' ? 0 : 1 );
751+ int iter = OBJECT_GENERATOR_KEY_SET_ITER;
752+ if (m_config->key_pattern [0 ] == ' R' )
753+ iter = OBJECT_GENERATOR_KEY_RANDOM;
754+ else if (m_config->key_pattern [0 ] == ' G' )
755+ iter = OBJECT_GENERATOR_KEY_GAUSSIAN;
756+ data_object *obj = m_obj_gen->get_object (iter);
738757 unsigned int key_len;
739758 const char *key = obj->get_key (&key_len);
740759 unsigned int value_len;
741760 const char *value = obj->get_value (&value_len);
742761 unsigned int cmd_size;
743762
744763 m_set_ratio_count++;
745- cmd_size = m_protocol->write_command_get (key, key_len);
764+ cmd_size = m_protocol->write_command_get (key, key_len, m_config-> data_offset );
746765
747766 m_pipeline.push (new verify_client::verify_request (rt_get,
748767 cmd_size, NULL , 1 , key, key_len, value, value_len));
@@ -758,7 +777,12 @@ void verify_client::create_request(void)
758777 m_keylist->clear ();
759778 while (m_keylist->get_keys_count () < keys_count) {
760779 unsigned int keylen;
761- const char *key = m_obj_gen->get_key (m_config->key_pattern [2 ] == ' R' ? 0 : 2 , &keylen);
780+ int iter = OBJECT_GENERATOR_KEY_GET_ITER;
781+ if (m_config->key_pattern [2 ] == ' R' )
782+ iter = OBJECT_GENERATOR_KEY_RANDOM;
783+ else if (m_config->key_pattern [2 ] == ' G' )
784+ iter = OBJECT_GENERATOR_KEY_GAUSSIAN;
785+ const char *key = m_obj_gen->get_key (iter, &keylen);
762786
763787 assert (key != NULL );
764788 assert (keylen > 0 );
@@ -769,7 +793,12 @@ void verify_client::create_request(void)
769793 m_get_ratio_count += keys_count;
770794 } else {
771795 unsigned int keylen;
772- m_obj_gen->get_key (m_config->key_pattern [2 ] == ' R' ? 0 : 2 , &keylen);
796+ int iter = OBJECT_GENERATOR_KEY_GET_ITER;
797+ if (m_config->key_pattern [2 ] == ' R' )
798+ iter = OBJECT_GENERATOR_KEY_RANDOM;
799+ else if (m_config->key_pattern [2 ] == ' G' )
800+ iter = OBJECT_GENERATOR_KEY_GAUSSIAN;
801+ m_obj_gen->get_key (iter, &keylen);
773802 m_get_ratio_count++;
774803 }
775804
@@ -1342,7 +1371,7 @@ void run_stats::summarize(totals& result) const
13421371 result.m_bytes_sec = (double ) ((result.m_bytes / 1024 ) / test_duration_sec);
13431372}
13441373
1345- void run_stats::print (FILE *out)
1374+ void run_stats::print (FILE *out, bool histogram )
13461375{
13471376 // aggregate all one_second_stats; we do this only if we have
13481377 // one_second_stats, otherwise it means we're probably printing previously
@@ -1382,6 +1411,9 @@ void run_stats::print(FILE *out)
13821411 m_totals.m_latency ,
13831412 m_totals.m_bytes_sec );
13841413
1414+ if (!histogram)
1415+ return ;
1416+
13851417 fprintf (out,
13861418 " \n\n "
13871419 " Request Latency Distribution\n "
0 commit comments