Fix a bug where we printed the incorrect value for out-of-order UDP packets.

Fixes #329, submitted by @bhegardt.

While here, add this value to the JSON output.
This commit is contained in:
Bruce A. Mah 2015-11-20 08:31:09 -08:00
parent 0e7921a7b4
commit 224ae8c764
No known key found for this signature in database
GPG Key ID: 4984910A8CAAEE8A

View File

@ -2349,13 +2349,13 @@ iperf_print_results(struct iperf_test *test)
/* Summary, UDP. */
lost_percent = 100.0 * sp->cnt_error / (sp->packet_count - sp->omitted_packet_count);
if (test->json_output)
cJSON_AddItemToObject(json_summary_stream, "udp", iperf_json_printf("socket: %d start: %f end: %f seconds: %f bytes: %d bits_per_second: %f jitter_ms: %f lost_packets: %d packets: %d lost_percent: %f", (int64_t) sp->socket, (double) start_time, (double) end_time, (double) end_time, (int64_t) bytes_sent, bandwidth * 8, (double) sp->jitter * 1000.0, (int64_t) sp->cnt_error, (int64_t) (sp->packet_count - sp->omitted_packet_count), (double) lost_percent));
cJSON_AddItemToObject(json_summary_stream, "udp", iperf_json_printf("socket: %d start: %f end: %f seconds: %f bytes: %d bits_per_second: %f jitter_ms: %f lost_packets: %d packets: %d lost_percent: %f out_of_order: %d", (int64_t) sp->socket, (double) start_time, (double) end_time, (double) end_time, (int64_t) bytes_sent, bandwidth * 8, (double) sp->jitter * 1000.0, (int64_t) sp->cnt_error, (int64_t) (sp->packet_count - sp->omitted_packet_count), (double) lost_percent, (int64_t) sp->outoforder_packets));
else {
iprintf(test, report_bw_udp_format, sp->socket, start_time, end_time, ubuf, nbuf, sp->jitter * 1000.0, sp->cnt_error, (sp->packet_count - sp->omitted_packet_count), lost_percent, "");
if (test->role == 'c')
iprintf(test, report_datagrams, sp->socket, (sp->packet_count - sp->omitted_packet_count));
if (sp->outoforder_packets > 0)
iprintf(test, report_sum_outoforder, start_time, end_time, sp->cnt_error);
iprintf(test, report_sum_outoforder, start_time, end_time, sp->outoforder_packets);
}
}