diff mbox

[API-NEXT,v2,2/6] performance: pktio_perf: use odp_time_wait() function instead of looping

Message ID 1450182567-7646-3-git-send-email-ivan.khoronzhuk@linaro.org
State New
Headers show

Commit Message

Ivan Khoronzhuk Dec. 15, 2015, 12:29 p.m. UTC
Now odp_time_wait() can be used instead of own implementation.

Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
---
 test/performance/odp_pktio_perf.c | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)
diff mbox

Patch

diff --git a/test/performance/odp_pktio_perf.c b/test/performance/odp_pktio_perf.c
index 8737bc8..7e3a8b0 100644
--- a/test/performance/odp_pktio_perf.c
+++ b/test/performance/odp_pktio_perf.c
@@ -591,20 +591,6 @@  static int setup_txrx_masks(odp_cpumask_t *thd_mask_tx,
 }
 
 /*
- * Busy loop for specified length of time.
- */
-static void busy_loop_ns(uint64_t wait_ns)
-{
-	odp_time_t wait = odp_time_local_from_ns(wait_ns);
-	odp_time_t cur = odp_time_local();
-	odp_time_t end_time = odp_time_sum(cur, wait);
-
-	do {
-		cur = odp_time_local();
-	} while (odp_time_cmp(end_time, cur) > 0);
-}
-
-/*
  * Run a single instance of the throughput test. When attempting to determine
  * the maximum packet rate this will be invoked multiple times with the only
  * difference between runs being the target PPS rate.
@@ -617,6 +603,7 @@  static int run_test_single(odp_cpumask_t *thd_mask_tx,
 	thread_args_t args_tx, args_rx;
 	uint64_t expected_tx_cnt;
 	int num_tx_workers, num_rx_workers;
+	odp_time_t shutdown_delay = odp_time_local_from_ns(SHUTDOWN_DELAY_NS);
 
 	odp_atomic_store_u32(&shutdown, 0);
 
@@ -647,7 +634,7 @@  static int run_test_single(odp_cpumask_t *thd_mask_tx,
 				num_tx_workers);
 
 	/* delay to allow transmitted packets to reach the receivers */
-	busy_loop_ns(SHUTDOWN_DELAY_NS);
+	odp_time_wait(shutdown_delay);
 
 	/* indicate to the receivers to exit */
 	odp_atomic_store_u32(&shutdown, 1);