There cannot be used direct comparison of timestamps of counter that can overflow, better to compare ranges.
Signed-off-by: Ivan Khoronzhuk <[email protected]> --- test/performance/odp_pktio_perf.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/test/performance/odp_pktio_perf.c b/test/performance/odp_pktio_perf.c index 018b7f5..09e1f6f 100644 --- a/test/performance/odp_pktio_perf.c +++ b/test/performance/odp_pktio_perf.c @@ -591,9 +591,13 @@ static int setup_txrx_masks(odp_cpumask_t *thd_mask_tx, */ static void busy_loop_ns(uint64_t wait_ns) { - uint64_t end = odp_time_cycles() + odp_time_ns_to_cycles(wait_ns); - while (odp_time_cycles() < end) - ; + uint64_t diff; + uint64_t start_time = odp_time_cycles(); + uint64_t wait = odp_time_ns_to_cycles(wait_ns); + + do { + diff = odp_time_diff_cycles(start_time, odp_time_cycles()); + } while (diff < wait); } /* -- 1.9.1 _______________________________________________ lng-odp mailing list [email protected] https://lists.linaro.org/mailman/listinfo/lng-odp
