Message ID | 1446721478-30656-2-git-send-email-ivan.khoronzhuk@linaro.org |
---|---|
State | Superseded |
Headers | show |
diff --git a/test/performance/odp_pktio_perf.c b/test/performance/odp_pktio_perf.c index efd26dc..ae5b4c0 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); } /*
There cannot be used direct comparison of timestamps of counter that can overflow, better to compare ranges. Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> --- test/performance/odp_pktio_perf.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)