Couple of improvements to the report format.

This commit is contained in:
Jef Poskanzer 2013-11-11 12:16:38 -08:00
parent a98b10bf91
commit b47e9f6a66
2 changed files with 20 additions and 27 deletions

View File

@ -1672,12 +1672,12 @@ iperf_print_intermediate(struct iperf_test *test)
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));
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:"");
} else {
if (test->json_output)
cJSON_AddItemToObject(json_interval, "sum", iperf_json_printf("start: %f end: %f seconds: %f bytes: %d bits_per_second: %f omitted: %b", (double) start_time, (double) end_time, (double) irp->interval_duration, (int64_t) bytes, bandwidth * 8, test->omitting));
else
iprintf(test, report_sum_bw_format, start_time, end_time, ubuf, nbuf, test->omitting?report_omitted:"");
iprintf(test, report_sum_bw_format, start_time, end_time, ubuf, nbuf, "", test->omitting?report_omitted:"");
}
}
}
@ -1708,6 +1708,7 @@ iperf_print_results(struct iperf_test *test)
return;
cJSON_AddItemToObject(test->json_end, "streams", json_summary_streams);
} else {
iprintf(test, "%s", report_bw_separator);
if (test->verbose)
iprintf(test, "%s", report_summary);
if (test->protocol->id == Ptcp)
@ -1749,18 +1750,16 @@ iperf_print_results(struct iperf_test *test)
bandwidth = (double) bytes_sent / (double) end_time;
unit_snprintf(nbuf, UNIT_LEN, bandwidth, test->settings->unit_format);
if (test->protocol->id == Ptcp) {
if (!test->json_output)
iprintf(test, " Sent\n");
if (test->sender_has_retransmits) {
if (test->json_output)
cJSON_AddItemToObject(json_summary_stream, "sent", iperf_json_printf("socket: %d start: %f end: %f seconds: %f bytes: %d bits_per_second: %f retransmits: %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));
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", (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));
else
iprintf(test, report_bw_retrans_format, sp->socket, start_time, end_time, ubuf, nbuf, sp->result->stream_retrans, "");
iprintf(test, report_bw_retrans_format, sp->socket, start_time, end_time, ubuf, nbuf, sp->result->stream_retrans, report_sender, "");
} else {
if (test->json_output)
cJSON_AddItemToObject(json_summary_stream, "sent", iperf_json_printf("socket: %d start: %f end: %f seconds: %f bytes: %d bits_per_second: %f", (int64_t) sp->socket, (double) start_time, (double) end_time, (double) end_time, (int64_t) bytes_sent, bandwidth * 8));
cJSON_AddItemToObject(json_summary_stream, "sender", iperf_json_printf("socket: %d start: %f end: %f seconds: %f bytes: %d bits_per_second: %f", (int64_t) sp->socket, (double) start_time, (double) end_time, (double) end_time, (int64_t) bytes_sent, bandwidth * 8));
else
iprintf(test, report_bw_format, sp->socket, start_time, end_time, ubuf, nbuf, "");
iprintf(test, report_bw_format, sp->socket, start_time, end_time, ubuf, nbuf, test->sender?report_sender:report_receiver, "");
}
} else {
out_of_order_percent = 100.0 * sp->cnt_error / (sp->packet_count - sp->omitted_packet_count);
@ -1790,12 +1789,10 @@ iperf_print_results(struct iperf_test *test)
bandwidth = (double) bytes_received / (double) end_time;
unit_snprintf(nbuf, UNIT_LEN, bandwidth, test->settings->unit_format);
if (test->protocol->id == Ptcp) {
if (!test->json_output)
iprintf(test, " Received\n");
if (test->json_output)
cJSON_AddItemToObject(json_summary_stream, "received", iperf_json_printf("socket: %d start: %f end: %f seconds: %f bytes: %d bits_per_second: %f", (int64_t) sp->socket, (double) start_time, (double) end_time, (double) end_time, (int64_t) bytes_received, bandwidth * 8));
cJSON_AddItemToObject(json_summary_stream, "receiver", iperf_json_printf("socket: %d start: %f end: %f seconds: %f bytes: %d bits_per_second: %f", (int64_t) sp->socket, (double) start_time, (double) end_time, (double) end_time, (int64_t) bytes_received, bandwidth * 8));
else
iprintf(test, report_bw_format, sp->socket, start_time, end_time, ubuf, nbuf, "");
iprintf(test, report_bw_format, sp->socket, start_time, end_time, ubuf, nbuf, report_receiver, "");
}
}
@ -1804,28 +1801,24 @@ iperf_print_results(struct iperf_test *test)
bandwidth = (double) total_sent / (double) end_time;
unit_snprintf(nbuf, UNIT_LEN, bandwidth, test->settings->unit_format);
if (test->protocol->id == Ptcp) {
if (!test->json_output)
iprintf(test, " Total sent\n");
if (test->sender_has_retransmits) {
if (test->json_output)
cJSON_AddItemToObject(test->json_end, "sum_sent", iperf_json_printf("start: %f end: %f seconds: %f bytes: %d bits_per_second: %f retransmits: %d", (double) start_time, (double) end_time, (double) end_time, (int64_t) total_sent, bandwidth * 8, (int64_t) total_retransmits));
else
iprintf(test, report_sum_bw_retrans_format, start_time, end_time, ubuf, nbuf, total_retransmits, "");
iprintf(test, report_sum_bw_retrans_format, start_time, end_time, ubuf, nbuf, total_retransmits, report_sender, "");
} else {
if (test->json_output)
cJSON_AddItemToObject(test->json_end, "sum_sent", iperf_json_printf("start: %f end: %f seconds: %f bytes: %d bits_per_second: %f", (double) start_time, (double) end_time, (double) end_time, (int64_t) total_sent, bandwidth * 8));
else
iprintf(test, report_sum_bw_format, start_time, end_time, ubuf, nbuf, "");
iprintf(test, report_sum_bw_format, start_time, end_time, ubuf, nbuf, report_sender, "");
}
unit_snprintf(ubuf, UNIT_LEN, (double) total_received, 'A');
bandwidth = (double) total_received / (double) end_time;
unit_snprintf(nbuf, UNIT_LEN, bandwidth, test->settings->unit_format);
if (!test->json_output)
iprintf(test, " Total received\n");
if (test->json_output)
cJSON_AddItemToObject(test->json_end, "sum_received", iperf_json_printf("start: %f end: %f seconds: %f bytes: %d bits_per_second: %f", (double) start_time, (double) end_time, (double) end_time, (int64_t) total_received, bandwidth * 8));
else
iprintf(test, report_sum_bw_format, start_time, end_time, ubuf, nbuf, "");
iprintf(test, report_sum_bw_format, start_time, end_time, ubuf, nbuf, report_receiver, "");
} else {
avg_jitter /= test->num_streams;
loss_percent = 100.0 * lost_packets / total_packets;
@ -1839,7 +1832,7 @@ iperf_print_results(struct iperf_test *test)
if (test->json_output)
cJSON_AddItemToObject(test->json_end, "cpu_utilization_percent", iperf_json_printf("host: %f remote: %f", (double) test->cpu_util, (double) test->remote_cpu_util));
else if (test->verbose)
iprintf(test, report_cpu, report_local, test->sender ? report_sender : report_receiver, test->cpu_util, report_remote, test->sender ? report_receiver: report_sender, test->remote_cpu_util);
iprintf(test, report_cpu, report_local, test->sender?report_sender:report_receiver, test->cpu_util, report_remote, test->sender?report_receiver:report_sender, test->remote_cpu_util);
}
/**************************************************************************/
@ -1909,12 +1902,12 @@ 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 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, irp->omitted));
else
iprintf(test, report_bw_retrans_format, sp->socket, st, et, ubuf, nbuf, irp->interval_retrans, irp->omitted?report_omitted:"");
iprintf(test, report_bw_retrans_format, sp->socket, st, et, ubuf, nbuf, irp->interval_retrans, "", irp->omitted?report_omitted:"");
} else {
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 omitted: %b", (int64_t) sp->socket, (double) st, (double) et, (double) irp->interval_duration, (int64_t) irp->bytes_transferred, bandwidth * 8, irp->omitted));
else
iprintf(test, report_bw_format, sp->socket, st, et, ubuf, nbuf, irp->omitted?report_omitted:"");
iprintf(test, report_bw_format, sp->socket, st, et, ubuf, nbuf, "", irp->omitted?report_omitted:"");
}
}

View File

@ -226,10 +226,10 @@ const char report_bw_udp_header[] =
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%s\n";
const char report_bw_retrans_format[] =
"[%3d] %6.2f-%-6.2f sec %ss %ss/sec %d%s\n";
"[%3d] %6.2f-%-6.2f sec %ss %ss/sec %3d %s%s\n";
const char report_bw_udp_format[] =
"[%3d] %6.2f-%-6.2f sec %ss %ss/sec %5.3f ms %d/%d (%.2g%%)\n";
@ -238,15 +238,15 @@ 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%s\n";
const char report_sum_bw_retrans_format[] =
"[SUM] %6.2f-%-6.2f sec %ss %ss/sec %d%s\n";
"[SUM] %6.2f-%-6.2f sec %ss %ss/sec %3d %s%s\n";
const char report_sum_bw_udp_format[] =
"[SUM] %6.2f-%-6.2f sec %ss %ss/sec %5.3f ms %d/%d (%.2g%%)\n";
const char report_omitted[] = " (omitted)";
const char report_omitted[] = "(omitted)";
const char report_bw_separator[] =
"- - - - - - - - - - - - - - - - - - - - - - - - -\n";