examples: add flush after stats printing
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>
This commit is contained in:
parent
c79a1c6746
commit
3ee6f70651
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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 */
|
||||
|
@ -334,6 +334,8 @@ print_stats(void)
|
||||
total_packets_dropped,
|
||||
total_packets_errors);
|
||||
printf("\n====================================================\n");
|
||||
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -516,6 +516,8 @@ print_stats(struct l2fwd_resources *rsrc)
|
||||
total_packets_rx,
|
||||
total_packets_dropped);
|
||||
printf("\n====================================================\n");
|
||||
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -146,6 +146,8 @@ print_stats(void)
|
||||
total_packets_rx,
|
||||
total_packets_dropped);
|
||||
printf("\n====================================================\n");
|
||||
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -162,6 +162,8 @@ print_stats(void)
|
||||
total_packets_rx,
|
||||
total_packets_dropped);
|
||||
printf("\n====================================================\n");
|
||||
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1110,6 +1110,8 @@ print_stats(__rte_unused void *arg)
|
||||
dev_ll = dev_ll->next;
|
||||
}
|
||||
printf("\n================================================\n");
|
||||
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
@ -1334,6 +1334,8 @@ print_stats(__rte_unused void *arg)
|
||||
}
|
||||
|
||||
printf("===================================================\n");
|
||||
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
Loading…
x
Reference in New Issue
Block a user