Include summary structures in JSON even if there's only one stream.

This makes consuming the JSON easier and more consistent.

Resolves #151.

Submitted by:	@i2aaron
This commit is contained in:
Bruce A. Mah 2014-03-18 09:44:37 -07:00
parent 3fa8072e9b
commit 974c88e8d9
No known key found for this signature in database
GPG Key ID: 4984910A8CAAEE8A

View File

@ -1920,7 +1920,7 @@ iperf_print_intermediate(struct iperf_test *test)
}
/* next build string with sum of all streams */
if (test->num_streams > 1) {
if (test->num_streams > 1 || test->json_output) {
sp = SLIST_FIRST(&test->streams); /* reset back to 1st stream */
irp = TAILQ_LAST(&sp->result->interval_results, irlisthead); /* use 1st stream for timing info */
@ -2080,7 +2080,7 @@ iperf_print_results(struct iperf_test *test)
}
}
if (test->num_streams > 1) {
if (test->num_streams > 1 || test->json_output) {
unit_snprintf(ubuf, UNIT_LEN, (double) total_sent, 'A');
bandwidth = (double) total_sent / (double) end_time;
unit_snprintf(nbuf, UNIT_LEN, bandwidth, test->settings->unit_format);