From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 99C90A00BE for ; Tue, 28 Apr 2020 15:28:08 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1C23E1C00D; Tue, 28 Apr 2020 15:28:08 +0200 (CEST) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [67.231.154.164]) by dpdk.org (Postfix) with ESMTP id EBF512986; Tue, 28 Apr 2020 15:28:04 +0200 (CEST) Received: from mx1-us1.ppe-hosted.com (unknown [10.110.50.143]) by dispatch1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id 4EDFC2005A; Tue, 28 Apr 2020 13:28:04 +0000 (UTC) Received: from us4-mdac16-37.at1.mdlocal (unknown [10.110.51.52]) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id 4B2EB800A4; Tue, 28 Apr 2020 13:28:04 +0000 (UTC) X-Virus-Scanned: Proofpoint Essentials engine Received: from mx1-us1.ppe-hosted.com (unknown [10.110.49.33]) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id C14C040077; Tue, 28 Apr 2020 13:28:03 +0000 (UTC) Received: from webmail.solarflare.com (uk.solarflare.com [193.34.186.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id 6897F340067; Tue, 28 Apr 2020 13:28:03 +0000 (UTC) Received: from ukex01.SolarFlarecom.com (10.17.10.4) by ukex01.SolarFlarecom.com (10.17.10.4) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 28 Apr 2020 14:27:51 +0100 Received: from opal.uk.solarflarecom.com (10.17.10.1) by ukex01.SolarFlarecom.com (10.17.10.4) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Tue, 28 Apr 2020 14:27:51 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (ukv-loginhost.uk.solarflarecom.com [10.17.10.39]) by opal.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id 03SDRpLP016968; Tue, 28 Apr 2020 14:27:51 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id F343616139D; Tue, 28 Apr 2020 14:27:50 +0100 (BST) From: Andrew Rybchenko To: Nicolas Chautru , Bruce Richardson , Ferruh Yigit , "Declan Doherty" , Marko Kovacevic , Ori Kam , Radu Nicolau , Akhil Goyal , Tomasz Kantecki , Sunil Kumar Kori , "Pavan Nikhilesh" , John McNamara , Kirill Rybalchenko , Harry van Haaren , Xiaoyun Li , Maxime Coquelin , Zhihong Wang , Xiaolong Ye CC: , Georgiy Levashov , Date: Tue, 28 Apr 2020 14:27:41 +0100 Message-ID: <1588080462-32393-1-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.5.1020-25382.003 X-TM-AS-Result: No-0.553800-8.000000-10 X-TMASE-MatchedRID: itREeis4MNEtLI7A4AVY48n4BtwwB10HAgvM6h73BtoLt1T6w2Ze0vEF n0ZmFVwncWj1ODSuKGNrUNIhAohVCsfgFvmHWcDxL1wE1KWC9ipMQULTNXtspHS7//lqxurTcij MZrr2iZ2t2gtuWr1LmoIkS2U7FTVbEMMIOn8rAN6lImTUc1ZPYUqAhuLHn5fEyecVTULEYStBs1 Owil9bHbo9PKJkA971144CnPw5DRJOP86VSsrMrJ4CIKY/Hg3AGdQnQSTrKGPEQdG7H66TyHEqm 8QYBtMOpdeSMLFMoI8vQeguoBqjEy8tGKQRq7dq+aeor8Twue8Du0ikTSCfUwKITnl1nN6huPu+ 0eIKIvGAk+grF44oBAzwTq8SdDjgk3UkV5Qp4wSI45Rd9ORJwFlJvEhEss3fzQahrdQz77w= X-TM-AS-User-Approved-Sender: Yes X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--0.553800-8.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1020-25382.003 X-MDID: 1588080484-WYQf9cV_bhEx Subject: [dpdk-stable] [PATCH] examples: add flush after stats printing X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" From: Georgiy Levashov 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 Signed-off-by: Andrew Rybchenko --- 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