1
1

Merge pull request #377 from quasoft/forceflush

Add option `--forceflush` to force flushing of output at the end of each interval
Этот коммит содержится в:
Bruce A. Mah 2016-03-25 10:44:20 -07:00
родитель fab327943f 08a2de459b
Коммит 4fbdab392c
6 изменённых файлов: 16 добавлений и 1 удалений

Просмотреть файл

@ -82,6 +82,10 @@ the executable.
logfile file logfile file
send output to a log file. send output to a log file.
--forceflush
force flushing output at every interval. Used to avoid buffering when sending
output to pipe.
d, debug d, debug
emit debugging output. Primarily (perhaps exclusively) of use emit debugging output. Primarily (perhaps exclusively) of use
to developers. to developers.

Просмотреть файл

@ -236,6 +236,7 @@ struct iperf_test
int debug; /* -d option - enable debug */ int debug; /* -d option - enable debug */
int get_server_output; /* --get-server-output */ int get_server_output; /* --get-server-output */
int udp_counters_64bit; /* --use-64-bit-udp-counters */ int udp_counters_64bit; /* --use-64-bit-udp-counters */
int forceflush; /* --forceflush - flushing output at every interval */
int multisend; int multisend;

Просмотреть файл

@ -58,6 +58,10 @@ output in JSON format
.BR --logfile " \fIfile\fR" .BR --logfile " \fIfile\fR"
send output to a log file. send output to a log file.
.TP .TP
.BR --forceflush " "
force flushing output at every interval.
Used to avoid buffering when sending output to pipe.
.TP
.BR -d ", " --debug " " .BR -d ", " --debug " "
emit debugging output. emit debugging output.
Primarily (perhaps exclusively) of use to developers. Primarily (perhaps exclusively) of use to developers.

Просмотреть файл

@ -653,6 +653,7 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv)
#endif #endif
{"pidfile", required_argument, NULL, 'I'}, {"pidfile", required_argument, NULL, 'I'},
{"logfile", required_argument, NULL, OPT_LOGFILE}, {"logfile", required_argument, NULL, OPT_LOGFILE},
{"forceflush", no_argument, NULL, OPT_FORCEFLUSH},
{"get-server-output", no_argument, NULL, OPT_GET_SERVER_OUTPUT}, {"get-server-output", no_argument, NULL, OPT_GET_SERVER_OUTPUT},
{"udp-counters-64bit", no_argument, NULL, OPT_UDP_COUNTERS_64BIT}, {"udp-counters-64bit", no_argument, NULL, OPT_UDP_COUNTERS_64BIT},
{"debug", no_argument, NULL, 'd'}, {"debug", no_argument, NULL, 'd'},
@ -927,6 +928,9 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv)
case OPT_LOGFILE: case OPT_LOGFILE:
test->logfile = strdup(optarg); test->logfile = strdup(optarg);
break; break;
case OPT_FORCEFLUSH:
test->forceflush = 1;
break;
case OPT_GET_SERVER_OUTPUT: case OPT_GET_SERVER_OUTPUT:
test->get_server_output = 1; test->get_server_output = 1;
client_flag = 1; client_flag = 1;
@ -2582,7 +2586,7 @@ print_interval_results(struct iperf_test *test, struct iperf_stream *sp, cJSON *
} }
} }
if (test->logfile) if (test->logfile || test->forceflush)
iflush(test); iflush(test);
} }

Просмотреть файл

@ -50,6 +50,7 @@ struct iperf_stream;
#define OPT_UDP_COUNTERS_64BIT 4 #define OPT_UDP_COUNTERS_64BIT 4
#define OPT_CLIENT_PORT 5 #define OPT_CLIENT_PORT 5
#define OPT_NUMSTREAMS 6 #define OPT_NUMSTREAMS 6
#define OPT_FORCEFLUSH 7
/* states */ /* states */
#define TEST_START 1 #define TEST_START 1

Просмотреть файл

@ -108,6 +108,7 @@ const char usage_longstr[] = "Usage: iperf [-s|-c host] [options]\n"
" -V, --verbose more detailed output\n" " -V, --verbose more detailed output\n"
" -J, --json output in JSON format\n" " -J, --json output in JSON format\n"
" --logfile f send output to a log file\n" " --logfile f send output to a log file\n"
" --forceflush force flushing output at every interval\n"
" -d, --debug emit debugging output\n" " -d, --debug emit debugging output\n"
" -v, --version show version information and quit\n" " -v, --version show version information and quit\n"
" -h, --help show this message and quit\n" " -h, --help show this message and quit\n"