diff options
author | Bruce A. Mah <bmah@es.net> | 2014-02-14 11:17:43 -0800 |
---|---|---|
committer | Bruce A. Mah <bmah@es.net> | 2014-02-14 11:17:43 -0800 |
commit | d076653bd4a92a1587c8214a6e0603e25eda2307 (patch) | |
tree | dcaedcb49d2f2480aaa2ee160a0900e229695d24 /src/iperf_api.c | |
parent | 4addea850295d28afff630cb436000f0cb8988c0 (diff) | |
download | iperf3-d076653bd4a92a1587c8214a6e0603e25eda2307.tar.gz |
Output TCP snd_cwnd (on platforms supporting it) in normal output.
We were computing and printing this in JSON output mode anyway; this
change just exposes this quantity in a human-friendly manner (better
than the first attempt at this) when doing normal output.
Resolves Issue 99 (Additional TCP_INFO items).
Diffstat (limited to 'src/iperf_api.c')
-rw-r--r-- | src/iperf_api.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/iperf_api.c b/src/iperf_api.c index 193916f..f8822cd 100644 --- a/src/iperf_api.c +++ b/src/iperf_api.c @@ -1848,9 +1848,9 @@ iperf_print_intermediate(struct iperf_test *test) if (test->sender && test->sender_has_retransmits) { /* Interval sum, TCP with retransmits. */ if (test->json_output) - cJSON_AddItemToObject(json_interval, "sum", iperf_json_printf("start: %f end: %f seconds: %f bytes: %d bits_per_second: %f retransmits: %d omitted: %b", (double) start_time, (double) end_time, (double) irp->interval_duration, (int64_t) bytes, bandwidth * 8, (int64_t) retransmits, irp->omitted)); + cJSON_AddItemToObject(json_interval, "sum", iperf_json_printf("start: %f end: %f seconds: %f bytes: %d bits_per_second: %f retransmits: %d omitted: %b", (double) start_time, (double) end_time, (double) irp->interval_duration, (int64_t) bytes, bandwidth * 8, (int64_t) retransmits, irp->omitted)); /* XXX irp->omitted or test->omitting? */ else - iprintf(test, report_sum_bw_retrans_format, start_time, end_time, ubuf, nbuf, retransmits, irp->omitted?report_omitted:""); + iprintf(test, report_sum_bw_retrans_format, start_time, end_time, ubuf, nbuf, retransmits, irp->omitted?report_omitted:""); /* XXX irp->omitted or test->omitting? */ } else { /* Interval sum, TCP without retransmits. */ if (test->json_output) @@ -2066,6 +2066,7 @@ print_interval_results(struct iperf_test *test, struct iperf_stream *sp, cJSON * { char ubuf[UNIT_LEN]; char nbuf[UNIT_LEN]; + char cbuf[UNIT_LEN]; double st = 0., et = 0.; struct iperf_interval_results *irp = NULL; double bandwidth, lost_percent; @@ -2085,7 +2086,7 @@ print_interval_results(struct iperf_test *test, struct iperf_stream *sp, cJSON * if (timeval_equals(&sp->result->start_time, &irp->interval_start_time)) { if (test->protocol->id == Ptcp) { if (test->sender && test->sender_has_retransmits) - iprintf(test, "%s", report_bw_retrans_header); + iprintf(test, "%s", report_bw_retrans_cwnd_header); else iprintf(test, "%s", report_bw_header); } else { @@ -2112,7 +2113,8 @@ print_interval_results(struct iperf_test *test, struct iperf_stream *sp, cJSON * if (test->json_output) cJSON_AddItemToArray(json_interval_streams, iperf_json_printf("socket: %d start: %f end: %f seconds: %f bytes: %d bits_per_second: %f retransmits: %d snd_cwnd: %d omitted: %b", (int64_t) sp->socket, (double) st, (double) et, (double) irp->interval_duration, (int64_t) irp->bytes_transferred, bandwidth * 8, (int64_t) irp->interval_retrans, (int64_t) irp->snd_cwnd, irp->omitted)); else - iprintf(test, report_bw_retrans_format, sp->socket, st, et, ubuf, nbuf, irp->interval_retrans, irp->omitted?report_omitted:""); + unit_snprintf(cbuf, UNIT_LEN, irp->snd_cwnd, 'A'); + iprintf(test, report_bw_retrans_cwnd_format, sp->socket, st, et, ubuf, nbuf, irp->interval_retrans, cbuf, irp->omitted?report_omitted:""); } else { /* Interval, TCP without retransmits. */ if (test->json_output) |