Also maintain the min and mean of the RTT.

For issue #215.
This commit is contained in:
Bruce A. Mah 2014-10-23 13:39:58 -07:00
parent c7b0726a38
commit 29dbc41c1d
2 changed files with 11 additions and 1 deletions

View File

@ -91,6 +91,9 @@ struct iperf_stream_result
int stream_prev_total_sacks;
int stream_sacks;
int stream_max_rtt;
int stream_min_rtt;
int stream_sum_rtt;
int stream_count_rtt;
int stream_max_snd_cwnd;
struct timeval start_time;
struct timeval end_time;

View File

@ -2023,10 +2023,17 @@ iperf_stats_callback(struct iperf_test *test)
if (temp.snd_cwnd > rp->stream_max_snd_cwnd) {
rp->stream_max_snd_cwnd = temp.snd_cwnd;
}
temp.rtt = get_rtt(&temp);
if (temp.rtt > rp->stream_max_rtt) {
rp->stream_max_rtt = temp.rtt;
}
if (rp->stream_min_rtt == 0 ||
temp.rtt < rp->stream_min_rtt) {
rp->stream_min_rtt = temp.rtt;
}
rp->stream_sum_rtt += temp.rtt;
rp->stream_count_rtt++;
}
}
} else {
@ -2233,7 +2240,7 @@ iperf_print_results(struct iperf_test *test)
if (test->sender_has_retransmits) {
/* Summary, TCP with retransmits. */
if (test->json_output)
cJSON_AddItemToObject(json_summary_stream, "sender", iperf_json_printf("socket: %d start: %f end: %f seconds: %f bytes: %d bits_per_second: %f retransmits: %d max_snd_cwnd: %d max_rtt: %d", (int64_t) sp->socket, (double) start_time, (double) end_time, (double) end_time, (int64_t) bytes_sent, bandwidth * 8, (int64_t) sp->result->stream_retrans, (int64_t) sp->result->stream_max_snd_cwnd, (int64_t) sp->result->stream_max_rtt));
cJSON_AddItemToObject(json_summary_stream, "sender", iperf_json_printf("socket: %d start: %f end: %f seconds: %f bytes: %d bits_per_second: %f retransmits: %d max_snd_cwnd: %d max_rtt: %d min_rtt: %d mean_rtt: %d", (int64_t) sp->socket, (double) start_time, (double) end_time, (double) end_time, (int64_t) bytes_sent, bandwidth * 8, (int64_t) sp->result->stream_retrans, (int64_t) sp->result->stream_max_snd_cwnd, (int64_t) sp->result->stream_max_rtt, (int64_t) sp->result->stream_min_rtt, (int64_t) ((sp->result->stream_count_rtt == 0) ? 0 : sp->result->stream_sum_rtt / sp->result->stream_count_rtt)));
else
iprintf(test, report_bw_retrans_format, sp->socket, start_time, end_time, ubuf, nbuf, sp->result->stream_retrans, report_sender);
} else {