From cf59099b49474589075787fe79d12f71a4ca0e9e Mon Sep 17 00:00:00 2001 From: "Bruce A. Mah" Date: Wed, 15 Jan 2014 10:27:33 -0800 Subject: [PATCH] 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. --- src/iperf.h | 3 ++- src/iperf_api.c | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/iperf.h b/src/iperf.h index 41170ec..f391ea8 100644 --- a/src/iperf.h +++ b/src/iperf.h @@ -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 * 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 json_output; /* -J option - JSON output */ int zerocopy; /* -Z option - use sendfile */ + int debug; /* -d option - enable debug */ int multisend; int may_use_sigalrm; diff --git a/src/iperf_api.c b/src/iperf_api.c index f288011..202cf2f 100644 --- a/src/iperf_api.c +++ b/src/iperf_api.c @@ -543,6 +543,7 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv) #if defined(linux) {"linux-congestion", required_argument, NULL, 'C'}, #endif + {"debug", no_argument, NULL, 'd'}, {"help", no_argument, NULL, 'h'}, {NULL, 0, NULL, 0} }; @@ -554,7 +555,7 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv) blksize = 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) { case 'p': test->server_port = atoi(optarg); @@ -754,6 +755,9 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv) return -1; #endif /* linux */ break; + case 'd': + test->debug = 1; + break; case 'h': default: usage_long();