in src/parameter.c [380:557]
int parse_arguments(struct ntttcp_test *test, int argc, char **argv)
{
/* long options, for uncommon usage */
static struct option longopts[] = {
{"show-tcp-retrans", no_argument, NULL, LO_SHOW_TCP_RETRANS},
{"show-nic-packets", required_argument, NULL, LO_SHOW_NIC_PACKETS},
{"show-dev-interrupts", required_argument, NULL, LO_SHOW_DEV_INTERRUPTS},
{"fq-rate-limit", required_argument, NULL, LO_FQ_RATE_LIMIT},
{0, 0, 0, 0}
};
int opt;
while ((opt = getopt_long(argc, argv, "r::s::DMLeHm:P:n:l:6up:f::b:B:W:t:C:NO::x::j::QVh", longopts, NULL)) != -1) {
switch (opt) {
case 'r':
case 's':
if (opt == 'r') {
test->server_role = true;
} else {
test->client_role = true;
}
if (optarg) {
test->bind_address = optarg;
} else {
if (optind < argc && NULL != argv[optind] && '\0' != argv[optind][0] && '-' != argv[optind][0])
test->bind_address = argv[optind++];
}
break;
case 'D':
test->daemon = true;
break;
case 'M':
test->multi_clients_mode = true;
break;
case 'L':
test->last_client = true;
break;
case 'e':
test->use_epoll = true;
break;
case 'H':
test->exit_after_done = false;
break;
case 'm':
test->mapping = optarg;
process_mappings(test);
break;
case 'P':
test->server_ports = atoi(optarg);
break;
case 'n':
test->threads_per_server_port = atoi(optarg);
break;
case 'l':
test->conns_per_thread = atoi(optarg);
break;
case '6':
test->domain = AF_INET6;
break;
case 'u':
test->protocol = UDP;
break;
case 'p':
test->server_base_port = atoi(optarg);
break;
case 'f':
if (optarg) {
test->client_base_port = atoi(optarg);
} else {
if (optind < argc && NULL != argv[optind] && '\0' != argv[optind][0] && '-' != argv[optind][0]) {
test->client_base_port = atoi(argv[optind++]);
} else {
test->client_base_port = DEFAULT_BASE_SRC_PORT;
}
}
break;
case 'b':
test->recv_buf_size = unit_atod(optarg, BINARY_BASED_UNIT_K);
test->send_buf_size = unit_atod(optarg, BINARY_BASED_UNIT_K);
break;
case 'B':
test->bandwidth_limit = unit_atod(optarg, DECIMAL_BASED_UNIT_K);
break;
case LO_FQ_RATE_LIMIT:
test->fq_rate_limit = unit_atod(optarg, DECIMAL_BASED_UNIT_K);
break;
case 'W':
test->warmup = atoi(optarg);
break;
case 't':
test->duration = atoi(optarg);
break;
case 'C':
test->cooldown = atoi(optarg);
break;
case 'N':
test->no_synch = true;
break;
case LO_SHOW_TCP_RETRANS:
test->show_tcp_retransmit = true;
break;
case LO_SHOW_NIC_PACKETS:
test->show_interface_packets = optarg;
break;
case LO_SHOW_DEV_INTERRUPTS:
test->show_dev_interrupts = optarg;
break;
case 'O':
test->save_console_log = true;
if (optarg) {
test->console_log_filename = optarg;
} else {
if (optind < argc && NULL != argv[optind] && '\0' != argv[optind][0] && '-' != argv[optind][0])
test->console_log_filename = argv[optind++];
}
break;
case 'x':
test->save_xml_log = true;
if (optarg) {
test->xml_log_filename = optarg;
} else {
if (optind < argc && NULL != argv[optind] && '\0' != argv[optind][0] && '-' != argv[optind][0])
test->xml_log_filename = argv[optind++];
}
break;
case 'j':
test->save_json_log = true;
if (optarg) {
test->json_log_filename = optarg;
} else {
if (optind < argc && NULL != argv[optind] && '\0' != argv[optind][0] && '-' != argv[optind][0])
test->json_log_filename = argv[optind++];
}
break;
case 'Q':
test->quiet = true;
break;
case 'V':
test->verbose = true;
break;
case 'h':
default:
print_usage();
exit(ERROR_ARGS);
}
}
return NO_ERROR;
}