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).
Этот коммит содержится в:
родитель
4addea8502
Коммит
d076653bd4
@ -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)
|
||||
|
14
src/locale.c
14
src/locale.c
@ -235,6 +235,9 @@ const char report_bw_header[] =
|
||||
const char report_bw_retrans_header[] =
|
||||
"[ ID] Interval Transfer Bandwidth Retr\n";
|
||||
|
||||
const char report_bw_retrans_cwnd_header[] =
|
||||
"[ ID] Interval Transfer Bandwidth Retr Cwnd\n";
|
||||
|
||||
const char report_bw_udp_header[] =
|
||||
"[ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams\n";
|
||||
|
||||
@ -242,10 +245,13 @@ const char report_bw_udp_sender_header[] =
|
||||
"[ ID] Interval Transfer Bandwidth Total Datagrams\n";
|
||||
|
||||
const char report_bw_format[] =
|
||||
"[%3d] %6.2f-%-6.2f sec %ss %ss/sec %s\n";
|
||||
"[%3d] %6.2f-%-6.2f sec %ss %ss/sec %s\n";
|
||||
|
||||
const char report_bw_retrans_format[] =
|
||||
"[%3d] %6.2f-%-6.2f sec %ss %ss/sec %3d %s\n";
|
||||
"[%3d] %6.2f-%-6.2f sec %ss %ss/sec %3u %s\n";
|
||||
|
||||
const char report_bw_retrans_cwnd_format[] =
|
||||
"[%3d] %6.2f-%-6.2f sec %ss %ss/sec %3u %ss %s\n";
|
||||
|
||||
const char report_bw_udp_format[] =
|
||||
"[%3d] %6.2f-%-6.2f sec %ss %ss/sec %5.3f ms %d/%d (%.2g%%) %s\n";
|
||||
@ -257,10 +263,10 @@ const char report_summary[] =
|
||||
"Test Complete. Summary Results:\n";
|
||||
|
||||
const char report_sum_bw_format[] =
|
||||
"[SUM] %6.2f-%-6.2f sec %ss %ss/sec %s\n";
|
||||
"[SUM] %6.2f-%-6.2f sec %ss %ss/sec %s\n";
|
||||
|
||||
const char report_sum_bw_retrans_format[] =
|
||||
"[SUM] %6.2f-%-6.2f sec %ss %ss/sec %3d %s\n";
|
||||
"[SUM] %6.2f-%-6.2f sec %ss %ss/sec %3d %s\n";
|
||||
|
||||
const char report_sum_bw_udp_format[] =
|
||||
"[SUM] %6.2f-%-6.2f sec %ss %ss/sec %5.3f ms %d/%d (%.2g%%) %s\n";
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2009-2011, 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.
|
||||
*
|
||||
@ -46,10 +46,12 @@ extern const char report_read_lengths[] ;
|
||||
extern const char report_read_length_times[] ;
|
||||
extern const char report_bw_header[] ;
|
||||
extern const char report_bw_retrans_header[] ;
|
||||
extern const char report_bw_retrans_cwnd_header[] ;
|
||||
extern const char report_bw_udp_header[] ;
|
||||
extern const char report_bw_udp_sender_header[] ;
|
||||
extern const char report_bw_format[] ;
|
||||
extern const char report_bw_retrans_format[] ;
|
||||
extern const char report_bw_retrans_cwnd_format[] ;
|
||||
extern const char report_bw_udp_format[] ;
|
||||
extern const char report_bw_udp_sender_format[] ;
|
||||
extern const char report_summary[] ;
|
||||
|
@ -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.
|
||||
*
|
||||
@ -81,6 +81,12 @@ save_tcpinfo(struct iperf_stream *sp, struct iperf_interval_results *irp)
|
||||
|
||||
if (getsockopt(sp->socket, IPPROTO_TCP, TCP_INFO, (void *)&irp->tcpInfo, &tcp_info_length) < 0)
|
||||
iperf_err(sp->test, "getsockopt - %s", strerror(errno));
|
||||
|
||||
if (sp->test->debug) {
|
||||
printf("tcpi_snd_cwnd %u tcpi_snd_mss %u\n",
|
||||
irp->tcpInfo.tcpi_snd_cwnd, irp->tcpInfo.tcpi_snd_mss);
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user