]> git.droids-corp.org - dpdk.git/commitdiff
examples: add flush after stats printing
authorGeorgiy Levashov <georgiy.levashov@oktetlabs.ru>
Tue, 28 Apr 2020 13:27:41 +0000 (14:27 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Wed, 24 Jun 2020 22:20:01 +0000 (00:20 +0200)
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
examples/ioat/ioatfwd.c
examples/kni/main.c
examples/l2fwd-crypto/main.c
examples/l2fwd-event/main.c
examples/l2fwd-jobstats/main.c
examples/l2fwd-keepalive/main.c
examples/l2fwd/main.c
examples/link_status_interrupt/main.c
examples/tep_termination/main.c
examples/vhost/main.c

index fb38dc3a72cba3164988d83c41d5c68dd6e7420c..68a46050c048791563cecde9e05337408c42f962 100644 (file)
@@ -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);
 }
index 53de231795f7cbe6141f168364df28938a706b75..b66ee73bcec42d9d7fc3faec8c211f8eada31505 100644 (file)
@@ -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;
index 80dd0353e773622f3ecfe6be22785396e3caa3b2..f5d12a5b8676f4abf1ae939f87ba60956cd72a5b 100644 (file)
@@ -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 */
index fcb55c370add3d17d921823dda623c20c61fbc23..827da9b3e38b7eb4428dc5dfdacc8c5c2f54e19a 100644 (file)
@@ -334,6 +334,8 @@ print_stats(void)
                   total_packets_dropped,
                   total_packets_errors);
        printf("\n====================================================\n");
+
+       fflush(stdout);
 }
 
 static int
index 9593ef11e357a0a79fade360166504e5136d1ce1..4fe500333cdcca027f89d99fe53f813493aac07c 100644 (file)
@@ -516,6 +516,8 @@ print_stats(struct l2fwd_resources *rsrc)
                   total_packets_rx,
                   total_packets_dropped);
        printf("\n====================================================\n");
+
+       fflush(stdout);
 }
 
 static void
index 396fd89db446e7d989ad80a7a2b3a0793af392eb..47a3b09765462b5dfb6ef3dac5c0e77cd3c4fc5d 100644 (file)
@@ -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);
 }
 
index b7585d55e1dd6b2112bac8593229e976c60fbd98..b2742633bc653d1f7f43bc50f3352aba0baf0366 100644 (file)
@@ -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
index f8d14b843a7f354b272638f242dd84c138d7499c..4a41aac638415d282d16000a0c03b438aee314d7 100644 (file)
@@ -146,6 +146,8 @@ print_stats(void)
                   total_packets_rx,
                   total_packets_dropped);
        printf("\n====================================================\n");
+
+       fflush(stdout);
 }
 
 static void
index 25efe2b09a20ef7cb0e6a2421fc1ab05f6b0f0ed..9bbcadfcf8b95fec366a737cba7eed099e917fd4 100644 (file)
@@ -162,6 +162,8 @@ print_stats(void)
                   total_packets_rx,
                   total_packets_dropped);
        printf("\n====================================================\n");
+
+       fflush(stdout);
 }
 
 static void
index ab956ad7ce963d5da8eacf2ce294be2ec01c27ad..b9fffca020a982fa078f691212db43149e969125 100644 (file)
@@ -1110,6 +1110,8 @@ print_stats(__rte_unused void *arg)
                        dev_ll = dev_ll->next;
                }
                printf("\n================================================\n");
+
+               fflush(stdout);
        }
 
        return NULL;
index ab649bf147e16b3267a6a2b4e337f47f0598408a..312829e8b9301989b4f4b3eafe0b9635bab377ef 100644 (file)
@@ -1334,6 +1334,8 @@ print_stats(__rte_unused void *arg)
                }
 
                printf("===================================================\n");
+
+               fflush(stdout);
        }
 
        return NULL;