diff mbox

[API-NEXT,v6] 2/9] test: performance: pktio: don't use direct arithmetic operations with odp_time_t

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

Commit Message

Ivan Khoronzhuk Dec. 3, 2015, 12:49 p.m. UTC
It was missed while unbinding cycles from time API names.
Correct is as it prevents for adding structure under odp_time_t.

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

Patch

diff --git a/test/performance/odp_pktio_perf.c b/test/performance/odp_pktio_perf.c
index ffe9844..2e49f50 100644
--- a/test/performance/odp_pktio_perf.c
+++ b/test/performance/odp_pktio_perf.c
@@ -338,10 +338,12 @@  static void *run_thread_tx(void *arg)
 	cur_time     = odp_time_local();
 	start_time   = cur_time;
 	burst_start_time = odp_time_diff(cur_time, burst_gap);
-	while (odp_time_diff(cur_time, start_time) < send_duration) {
+	while (odp_time_cmp(odp_time_diff(cur_time, start_time),
+			    send_duration) > 1) {
 		unsigned alloc_cnt = 0, tx_cnt;
 
-		if (odp_time_diff(cur_time, burst_start_time) < burst_gap) {
+		if (odp_time_cmp(odp_time_diff(cur_time, burst_start_time),
+				 burst_gap) > 1) {
 			cur_time = odp_time_local();
 			if (!odp_time_cmp(idle_start, ODP_TIME_NULL))
 				idle_start = cur_time;
@@ -357,7 +359,7 @@  static void *run_thread_tx(void *arg)
 			idle_start = ODP_TIME_NULL;
 		}
 
-		burst_start_time += burst_gap;
+		burst_start_time = odp_time_sum(burst_start_time, burst_gap);
 
 		alloc_cnt = alloc_packets(tx_event, batch_len - unsent_pkts);
 		if (alloc_cnt != batch_len)