From 99502d9409306af439f5add75efa5ee059e38087 Mon Sep 17 00:00:00 2001 From: jef Date: Mon, 29 Oct 2012 22:30:31 -0700 Subject: [PATCH] Re-jiggered the "Interval Transfer Bandwidth" header so it only appears at the start and end of the results, and added a separator line when there are both multiple streams and multiple intervals. --- src/iperf_api.c | 11 ++++++++++- src/locale.c | 3 +++ src/locale.h | 1 + 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/iperf_api.c b/src/iperf_api.c index e5a0fcd..5cad949 100644 --- a/src/iperf_api.c +++ b/src/iperf_api.c @@ -1443,8 +1443,17 @@ print_interval_results(struct iperf_test * test, struct iperf_stream * sp) printf("print_interval_results Error: interval_results = NULL \n"); return; } + /* First stream? */ if (sp == SLIST_FIRST(&test->streams)) { - printf(report_bw_header); + /* It it's the first interval, print the header; + ** else if there's more than one stream, print the separator; + ** else nothing. + */ + if (sp->result->start_time.tv_sec == ir->interval_start_time.tv_sec && + sp->result->start_time.tv_usec == ir->interval_start_time.tv_usec) + printf(report_bw_header); + else if (test->num_streams > 1) + printf(report_bw_separator); } unit_snprintf(ubuf, UNIT_LEN, (double) (ir->bytes_transferred), 'A'); diff --git a/src/locale.c b/src/locale.c index e99ff1e..9a06861 100644 --- a/src/locale.c +++ b/src/locale.c @@ -186,6 +186,9 @@ const char report_read_length_times[] = const char report_bw_header[] = "[ ID] Interval Transfer Bandwidth\n"; +const char report_bw_separator[] = +"- - - - - - - - - - - - - - - - - - - - - - - - -\n"; + const char report_bw_format[] = "[%3d] %4.2f-%4.2f sec %ss %ss/sec\n"; diff --git a/src/locale.h b/src/locale.h index 4c43788..770b179 100644 --- a/src/locale.h +++ b/src/locale.h @@ -34,6 +34,7 @@ extern char test_start_bytes[]; extern char report_read_lengths[] ; extern char report_read_length_times[] ; extern char report_bw_header[] ; +extern char report_bw_separator[] ; extern char report_bw_format[] ; extern char report_sum_bw_format[] ; extern char report_bw_jitter_loss_header[] ;