From: Andrew Rybchenko <arybchenko@solarflare.com>
To: Nicolas Chautru <nicolas.chautru@intel.com>,
Bruce Richardson <bruce.richardson@intel.com>,
Ferruh Yigit <ferruh.yigit@intel.com>,
"Declan Doherty" <declan.doherty@intel.com>,
Marko Kovacevic <marko.kovacevic@intel.com>,
Ori Kam <orika@mellanox.com>,
Radu Nicolau <radu.nicolau@intel.com>,
Akhil Goyal <akhil.goyal@nxp.com>,
Tomasz Kantecki <tomasz.kantecki@intel.com>,
Sunil Kumar Kori <skori@marvell.com>,
"Pavan Nikhilesh" <pbhagavatula@marvell.com>,
John McNamara <john.mcnamara@intel.com>,
Kirill Rybalchenko <kirill.rybalchenko@intel.com>,
Harry van Haaren <harry.van.haaren@intel.com>,
Xiaoyun Li <xiaoyun.li@intel.com>,
Maxime Coquelin <maxime.coquelin@redhat.com>,
Zhihong Wang <zhihong.wang@intel.com>,
Xiaolong Ye <xiaolong.ye@intel.com>
Cc: <dev@dpdk.org>, Georgiy Levashov <georgiy.levashov@oktetlabs.ru>,
<stable@dpdk.org>
Subject: [dpdk-dev] [PATCH] examples: add flush after stats printing
Date: Tue, 28 Apr 2020 14:27:41 +0100 [thread overview]
Message-ID: <1588080462-32393-1-git-send-email-arybchenko@solarflare.com> (raw)
From: Georgiy Levashov <georgiy.levashov@oktetlabs.ru>
When printf()'s stdout is line-buffered for terminal, it is fully
buffered for pipes. So, stdout listener can only get the output
when it is flushed (on program termination, when buffer is filled or
manual flush).
stdout buffer might fill slowly since every stats report could be small.
Also when it is fully filled it might contain a part of the last stats
report which makes it very inconvenient for any automation which reads
and parses the output.
Fixes: af75078fece3 ("first public release")
Cc: stable@dpdk.org
Signed-off-by: Georgiy Levashov <georgiy.levashov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
examples/bbdev_app/main.c | 2 ++
examples/ioat/ioatfwd.c | 2 ++
examples/kni/main.c | 2 ++
examples/l2fwd-crypto/main.c | 2 ++
examples/l2fwd-event/main.c | 2 ++
examples/l2fwd-jobstats/main.c | 3 +++
examples/l2fwd-keepalive/main.c | 2 ++
examples/l2fwd/main.c | 2 ++
examples/link_status_interrupt/main.c | 2 ++
examples/tep_termination/main.c | 2 ++
examples/vhost/main.c | 2 ++
11 files changed, 23 insertions(+)
diff --git a/examples/bbdev_app/main.c b/examples/bbdev_app/main.c
index fb38dc3a72..68a46050c0 100644
--- a/examples/bbdev_app/main.c
+++ b/examples/bbdev_app/main.c
@@ -659,6 +659,8 @@ print_stats(struct stats_lcore_params *stats_lcore)
print_lcore_stats(stats_lcore->lconf[l_id].lcore_stats, l_id);
}
+ fflush(stdout);
+
free(xstats);
free(xstats_names);
}
diff --git a/examples/ioat/ioatfwd.c b/examples/ioat/ioatfwd.c
index 7255ff3c9e..0de20cc7d6 100644
--- a/examples/ioat/ioatfwd.c
+++ b/examples/ioat/ioatfwd.c
@@ -294,6 +294,8 @@ print_stats(char *prgname)
printf("\n");
print_total_stats(&delta_ts);
+ fflush(stdout);
+
ts.total_packets_tx += delta_ts.total_packets_tx;
ts.total_packets_rx += delta_ts.total_packets_rx;
ts.total_packets_dropped += delta_ts.total_packets_dropped;
diff --git a/examples/kni/main.c b/examples/kni/main.c
index 29fc37e1fb..d9396310cc 100644
--- a/examples/kni/main.c
+++ b/examples/kni/main.c
@@ -158,6 +158,8 @@ print_stats(void)
kni_stats[i].tx_dropped);
}
printf("====== ============== ============ ============ ============ ============\n");
+
+ fflush(stdout);
}
/* Custom handling of signals to handle stats and kni processing */
diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
index 61d78295d4..506c303954 100644
--- a/examples/l2fwd-crypto/main.c
+++ b/examples/l2fwd-crypto/main.c
@@ -334,6 +334,8 @@ print_stats(void)
total_packets_dropped,
total_packets_errors);
printf("\n====================================================\n");
+
+ fflush(stdout);
}
static int
diff --git a/examples/l2fwd-event/main.c b/examples/l2fwd-event/main.c
index 9cc29d7324..9ce505167c 100644
--- a/examples/l2fwd-event/main.c
+++ b/examples/l2fwd-event/main.c
@@ -516,6 +516,8 @@ print_stats(struct l2fwd_resources *rsrc)
total_packets_rx,
total_packets_dropped);
printf("\n====================================================\n");
+
+ fflush(stdout);
}
static void
diff --git a/examples/l2fwd-jobstats/main.c b/examples/l2fwd-jobstats/main.c
index c1ca100ed0..1bcaec3c91 100644
--- a/examples/l2fwd-jobstats/main.c
+++ b/examples/l2fwd-jobstats/main.c
@@ -329,6 +329,9 @@ show_stats_cb(__rte_unused void *param)
}
printf("\n====================================================\n");
+
+ fflush(stdout);
+
rte_eal_alarm_set(timer_period * US_PER_S, show_stats_cb, NULL);
}
diff --git a/examples/l2fwd-keepalive/main.c b/examples/l2fwd-keepalive/main.c
index 2ae5a3c6a9..b1757c0b22 100644
--- a/examples/l2fwd-keepalive/main.c
+++ b/examples/l2fwd-keepalive/main.c
@@ -160,6 +160,8 @@ print_stats(__rte_unused struct rte_timer *ptr_timer,
total_packets_rx,
total_packets_dropped);
printf("\n====================================================\n");
+
+ fflush(stdout);
}
static void
diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c
index 88ddfe5897..623b74f2f3 100644
--- a/examples/l2fwd/main.c
+++ b/examples/l2fwd/main.c
@@ -146,6 +146,8 @@ print_stats(void)
total_packets_rx,
total_packets_dropped);
printf("\n====================================================\n");
+
+ fflush(stdout);
}
static void
diff --git a/examples/link_status_interrupt/main.c b/examples/link_status_interrupt/main.c
index 38422f6ac5..94802c7ca1 100644
--- a/examples/link_status_interrupt/main.c
+++ b/examples/link_status_interrupt/main.c
@@ -162,6 +162,8 @@ print_stats(void)
total_packets_rx,
total_packets_dropped);
printf("\n====================================================\n");
+
+ fflush(stdout);
}
static void
diff --git a/examples/tep_termination/main.c b/examples/tep_termination/main.c
index ab956ad7ce..b9fffca020 100644
--- a/examples/tep_termination/main.c
+++ b/examples/tep_termination/main.c
@@ -1110,6 +1110,8 @@ print_stats(__rte_unused void *arg)
dev_ll = dev_ll->next;
}
printf("\n================================================\n");
+
+ fflush(stdout);
}
return NULL;
diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index ab649bf147..312829e8b9 100644
--- a/examples/vhost/main.c
+++ b/examples/vhost/main.c
@@ -1334,6 +1334,8 @@ print_stats(__rte_unused void *arg)
}
printf("===================================================\n");
+
+ fflush(stdout);
}
return NULL;
--
2.17.1
next reply other threads:[~2020-04-28 13:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-28 13:27 Andrew Rybchenko [this message]
2020-06-24 22:22 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1588080462-32393-1-git-send-email-arybchenko@solarflare.com \
--to=arybchenko@solarflare.com \
--cc=akhil.goyal@nxp.com \
--cc=bruce.richardson@intel.com \
--cc=declan.doherty@intel.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=georgiy.levashov@oktetlabs.ru \
--cc=harry.van.haaren@intel.com \
--cc=john.mcnamara@intel.com \
--cc=kirill.rybalchenko@intel.com \
--cc=marko.kovacevic@intel.com \
--cc=maxime.coquelin@redhat.com \
--cc=nicolas.chautru@intel.com \
--cc=orika@mellanox.com \
--cc=pbhagavatula@marvell.com \
--cc=radu.nicolau@intel.com \
--cc=skori@marvell.com \
--cc=stable@dpdk.org \
--cc=tomasz.kantecki@intel.com \
--cc=xiaolong.ye@intel.com \
--cc=xiaoyun.li@intel.com \
--cc=zhihong.wang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).