Skip to content

Commit 2590be6

Browse files
authored
Add --host (-h) command line option for the Server address. (#224)
Co-authored-by: YaacovHazan <[email protected]>
1 parent 5c8be9c commit 2590be6

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

memtier_benchmark.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -407,11 +407,13 @@ static int config_parse_args(int argc, char *argv[], struct benchmark_config *cf
407407
o_tls_cacert,
408408
o_tls_skip_verify,
409409
o_tls_sni,
410-
o_hdr_file_prefix
410+
o_hdr_file_prefix,
411+
o_help
411412
};
412413

413414
static struct option long_options[] = {
414415
{ "server", 1, 0, 's' },
416+
{ "host", 1, 0, 'h' },
415417
{ "port", 1, 0, 'p' },
416418
{ "unix-socket", 1, 0, 'S' },
417419
{ "ipv4", 0, 0, '4' },
@@ -468,7 +470,7 @@ static int config_parse_args(int argc, char *argv[], struct benchmark_config *cf
468470
{ "wait-timeout", 1, 0, o_wait_timeout },
469471
{ "json-out-file", 1, 0, o_json_out_file },
470472
{ "cluster-mode", 0, 0, o_cluster_mode },
471-
{ "help", 0, 0, 'h' },
473+
{ "help", 0, 0, o_help },
472474
{ "version", 0, 0, 'v' },
473475
{ "command", 1, 0, o_command },
474476
{ "command-key-pattern", 1, 0, o_command_key_pattern },
@@ -483,7 +485,7 @@ static int config_parse_args(int argc, char *argv[], struct benchmark_config *cf
483485
"vs:S:p:P:o:x:DRn:c:t:d:a:h:46", long_options, &option_index)) != -1)
484486
{
485487
switch (c) {
486-
case 'h':
488+
case o_help:
487489
return -1;
488490
break;
489491
case 'v':
@@ -494,6 +496,7 @@ static int config_parse_args(int argc, char *argv[], struct benchmark_config *cf
494496
puts("There is NO WARRANTY, to the extent permitted by law.");
495497
exit(0);
496498
case 's':
499+
case 'h':
497500
cfg->server = optarg;
498501
break;
499502
case 'S':
@@ -883,7 +886,8 @@ void usage() {
883886
"A memcache/redis NoSQL traffic generator and performance benchmarking tool.\n"
884887
"\n"
885888
"Connection and General Options:\n"
886-
" -s, --server=ADDR Server address (default: localhost)\n"
889+
" -h, --host=ADDR Server address (default: localhost)\n"
890+
" -s, --server=ADDR Same as --host\n"
887891
" -p, --port=PORT Server port (default: 6379)\n"
888892
" -S, --unix-socket=SOCKET UNIX Domain socket name (default: none)\n"
889893
" -4, --ipv4 Force IPv4 address resolution.\n"

0 commit comments

Comments
 (0)