diff options
author | Janne Peltonen <janne.peltonen@nokia.com> | 2022-01-27 12:15:39 +0200 |
---|---|---|
committer | Petri Savolainen <petri.savolainen@nokia.com> | 2022-02-03 13:12:27 +0200 |
commit | d886306f48255fb4508b5186c17e6072f0f74826 (patch) | |
tree | 56037599a587d90cc7036518df4c5b2be15cd568 /example | |
parent | 61c3fe8360a44a4467ce593878c75069cec18f42 (diff) |
example: classifier: print statistics at a better time
Print statistics output after the sleep that waits for packets to arrive.
Previously the statistics were printed out before the sleep, causing the
statistics of the last wait period not to be printed.
Signed-off-by: Janne Peltonen <janne.peltonen@nokia.com>
Reviewed-by: Tuomas Taipale <tuomas.taipale@nokia.com>
Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com>
Diffstat (limited to 'example')
-rw-r--r-- | example/classifier/odp_classifier.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c index d22c9a7df..94fc350df 100644 --- a/example/classifier/odp_classifier.c +++ b/example/classifier/odp_classifier.c @@ -187,6 +187,8 @@ static inline void print_cls_statistics(appl_args_t *args) infinite = 1; for (; timeout > 0 || infinite; timeout--) { + sleep(1); + printf("\r"); for (i = 0; i < args->policy_count; i++) { printf("%-6" PRIu64 " ", odp_atomic_load_u64(&args->stats[i] @@ -198,13 +200,10 @@ static inline void print_cls_statistics(appl_args_t *args) printf("%-" PRIu64, odp_atomic_load_u64(&args-> total_packets)); + fflush(stdout); if (args->shutdown_sig) break; - - sleep(1); - printf("\r"); - fflush(stdout); } printf("\n"); |