diff mbox

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

Message ID 1449251494-23210-3-git-send-email-ivan.khoronzhuk@linaro.org
State Accepted
Commit a07d411735ee1a6130107155d6cca1524c5b8ac8
Headers show

Commit Message

Ivan Khoronzhuk Dec. 4, 2015, 5:51 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.

Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
---
 test/performance/odp_pktio_perf.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/test/performance/odp_pktio_perf.c b/test/performance/odp_pktio_perf.c
index ffe9844..ec67d55 100644
--- a/test/performance/odp_pktio_perf.c
+++ b/test/performance/odp_pktio_perf.c
@@ -338,10 +338,13 @@  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(send_duration,
+			    odp_time_diff(cur_time, start_time)) > 0) {
 		unsigned alloc_cnt = 0, tx_cnt;
 
-		if (odp_time_diff(cur_time, burst_start_time) < burst_gap) {
+		if (odp_time_cmp(burst_gap,
+				 odp_time_diff(cur_time, burst_start_time))
+				 > 0) {
 			cur_time = odp_time_local();
 			if (!odp_time_cmp(idle_start, ODP_TIME_NULL))
 				idle_start = cur_time;
@@ -357,7 +360,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)