Add support for a -d debug flag to enable debugging output.

Mostly intended for developer use.  At the moment there are no public
uses for this flag.
This commit is contained in:
Bruce A. Mah 2014-01-15 10:27:33 -08:00
parent deefb95fea
commit cf59099b49
2 changed files with 7 additions and 2 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2009-2013, The Regents of the University of California, * Copyright (c) 2009-2014, The Regents of the University of California,
* through Lawrence Berkeley National Laboratory (subject to receipt of any * through Lawrence Berkeley National Laboratory (subject to receipt of any
* required approvals from the U.S. Dept. of Energy). All rights reserved. * required approvals from the U.S. Dept. of Energy). All rights reserved.
* *
@ -184,6 +184,7 @@ struct iperf_test
int verbose; /* -V option - verbose mode */ int verbose; /* -V option - verbose mode */
int json_output; /* -J option - JSON output */ int json_output; /* -J option - JSON output */
int zerocopy; /* -Z option - use sendfile */ int zerocopy; /* -Z option - use sendfile */
int debug; /* -d option - enable debug */
int multisend; int multisend;
int may_use_sigalrm; int may_use_sigalrm;

View File

@ -543,6 +543,7 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv)
#if defined(linux) #if defined(linux)
{"linux-congestion", required_argument, NULL, 'C'}, {"linux-congestion", required_argument, NULL, 'C'},
#endif #endif
{"debug", no_argument, NULL, 'd'},
{"help", no_argument, NULL, 'h'}, {"help", no_argument, NULL, 'h'},
{NULL, 0, NULL, 0} {NULL, 0, NULL, 0}
}; };
@ -554,7 +555,7 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv)
blksize = 0; blksize = 0;
server_flag = client_flag = rate_flag = duration_flag = 0; server_flag = client_flag = rate_flag = duration_flag = 0;
while ((flag = getopt_long(argc, argv, "p:f:i:DVJvsc:ub:t:n:k:l:P:Rw:B:M:N46S:L:ZO:F:A:T:C:h", longopts, NULL)) != -1) { while ((flag = getopt_long(argc, argv, "p:f:i:DVJvsc:ub:t:n:k:l:P:Rw:B:M:N46S:L:ZO:F:A:T:C:dh", longopts, NULL)) != -1) {
switch (flag) { switch (flag) {
case 'p': case 'p':
test->server_port = atoi(optarg); test->server_port = atoi(optarg);
@ -754,6 +755,9 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv)
return -1; return -1;
#endif /* linux */ #endif /* linux */
break; break;
case 'd':
test->debug = 1;
break;
case 'h': case 'h':
default: default:
usage_long(); usage_long();