Fixed TCP_INFO bug on linux. BSD prints nothing for now...

This commit is contained in:
sethdelliott 2011-03-16 18:17:54 +00:00
parent e170832926
commit fecb120f91
2 changed files with 9 additions and 6 deletions

View File

@ -342,6 +342,7 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv)
break; break;
case 'T': case 'T':
#if !defined(linux) && !defined(__FreeBSD__) #if !defined(linux) && !defined(__FreeBSD__)
// XXX: Should check to make sure UDP mode isn't set!
warning("TCP_INFO (-T) is not supported on your current platform"); warning("TCP_INFO (-T) is not supported on your current platform");
#else #else
test->tcp_info = 1; test->tcp_info = 1;
@ -1267,11 +1268,6 @@ iperf_reporter_callback(struct iperf_test * test)
printf(" Sent\n"); printf(" Sent\n");
printf(report_bw_format, sp->socket, start_time, end_time, ubuf, nbuf); printf(report_bw_format, sp->socket, start_time, end_time, ubuf, nbuf);
if (test->tcp_info) {
// ip = sp->result->last_interval_results;
// print_tcpinfo(ip);
print_tcpinfo(test);
}
} else { } else {
printf(report_bw_jitter_loss_format, sp->socket, start_time, printf(report_bw_jitter_loss_format, sp->socket, start_time,
@ -1310,6 +1306,13 @@ iperf_reporter_callback(struct iperf_test * test)
lost_packets, total_packets, (double) (100.0 * lost_packets / total_packets)); lost_packets, total_packets, (double) (100.0 * lost_packets / total_packets));
} }
} }
if (test->tcp_info) {
// ip = sp->result->last_interval_results;
// print_tcpinfo(ip);
print_tcpinfo(test);
}
if (test->verbose) { if (test->verbose) {
printf("Host CPU Utilization: %.1f%%\n", test->cpu_util); printf("Host CPU Utilization: %.1f%%\n", test->cpu_util);
printf("Remote CPU Utilization: %.1f%%\n", test->remote_cpu_util); printf("Remote CPU Utilization: %.1f%%\n", test->remote_cpu_util);

View File

@ -67,7 +67,7 @@ print_tcpinfo(struct iperf_test *test)
struct iperf_stream *sp; struct iperf_stream *sp;
#if defined(linux) #if defined(linux)
SLIST_FOREACH(sp, &test->streams, streams) { SLIST_FOREACH(sp, &test->streams, streams) {
retransmits += sp->result->last_interval_results.tcpInfo.tcpi_retransmits; retransmits += sp->result->last_interval_results->tcpInfo.tcpi_retransmits;
} }
printf("TCP Info\n"); printf("TCP Info\n");
printf(" Retransmits: %ld\n", retransmits); printf(" Retransmits: %ld\n", retransmits);