@@ -604,7 +604,7 @@ static void print_global_stats(int num_workers)
break;
}
- diff = odp_time_diff(start, odp_time_local());
+ diff = odp_time_diff(odp_time_local(), start);
if (odp_time_cmp(diff, wait) > 0)
continue;
@@ -54,12 +54,12 @@ odp_time_t odp_time_local(void);
/**
* Time difference
*
- * @param t1 First time stamp
* @param t2 Second time stamp
+ * @param t1 First time stamp
*
* @return Difference of time stamps
*/
-odp_time_t odp_time_diff(odp_time_t t1, odp_time_t t2);
+odp_time_t odp_time_diff(odp_time_t t2, odp_time_t t1);
/**
* Time sum
@@ -608,7 +608,7 @@ static int schedule_loop(odp_queue_t *out_queue, uint64_t wait,
}
time = odp_time_local();
- diff = odp_time_diff(start_time, time);
+ diff = odp_time_diff(time, start_time);
if (odp_time_cmp(diff, wait) > 0)
break;
@@ -31,7 +31,7 @@ odp_time_t odp_time_local(void)
return tick_to_time(odp_cpu_cycles());
}
-odp_time_t odp_time_diff(odp_time_t t1, odp_time_t t2)
+odp_time_t odp_time_diff(odp_time_t t2, odp_time_t t1)
{
return tick_to_time(_odp_cpu_cycles_diff(t1, t2));
}
@@ -337,11 +337,11 @@ static void *run_thread_tx(void *arg)
cur_time = odp_time_local();
start_time = cur_time;
- burst_start_time = odp_time_diff(burst_gap, cur_time);
- while (odp_time_diff(start_time, cur_time) < send_duration) {
+ burst_start_time = odp_time_diff(cur_time, burst_gap);
+ while (odp_time_diff(cur_time, start_time) < send_duration) {
unsigned alloc_cnt = 0, tx_cnt;
- if (odp_time_diff(burst_start_time, cur_time) < burst_gap) {
+ if (odp_time_diff(cur_time, burst_start_time) < burst_gap) {
cur_time = odp_time_local();
if (!odp_time_cmp(ODP_TIME_NULL, idle_start))
idle_start = cur_time;
@@ -349,7 +349,7 @@ static void *run_thread_tx(void *arg)
}
if (odp_time_cmp(ODP_TIME_NULL, idle_start)) {
- odp_time_t diff = odp_time_diff(idle_start, cur_time);
+ odp_time_t diff = odp_time_diff(cur_time, idle_start);
stats->s.idle_ticks =
odp_time_sum(diff, stats->s.idle_ticks);
@@ -600,7 +600,7 @@ static void busy_loop_ns(uint64_t wait_ns)
odp_time_t wait = odp_time_local_from_ns(wait_ns);
do {
- diff = odp_time_diff(start_time, odp_time_local());
+ diff = odp_time_diff(odp_time_local(), start_time);
} while (odp_time_cmp(diff, wait) > 0);
}
@@ -345,7 +345,7 @@ static odp_event_t queue_deq_wait_time(odp_queue_t queue, uint64_t ns)
if (ev != ODP_EVENT_INVALID)
return ev;
now = odp_time_local();
- diff = odp_time_diff(start, now);
+ diff = odp_time_diff(now, start);
} while (odp_time_to_ns(diff) < ns);
return ODP_EVENT_INVALID;
@@ -389,7 +389,7 @@ static odp_packet_t wait_for_packet(pktio_info_t *pktio_rx,
}
now = odp_time_local();
- diff = odp_time_diff(start, now);
+ diff = odp_time_diff(now, start);
} while (odp_time_to_ns(diff) < ns);
CU_FAIL("failed to receive transmitted packet");
@@ -27,7 +27,7 @@ void time_test_odp_diff(void)
t2 = odp_time_local();
CU_ASSERT(odp_time_cmp(t1, t2) > 0);
- diff = odp_time_diff(t1, t2);
+ diff = odp_time_diff(t2, t1);
CU_ASSERT(odp_time_cmp(ODP_TIME_NULL, diff) > 0);
}
@@ -38,7 +38,7 @@ void time_test_odp_negative_diff(void)
t1 = 10;
t2 = 5;
- diff = odp_time_diff(t1, t2);
+ diff = odp_time_diff(t2, t1);
CU_ASSERT(odp_time_cmp(ODP_TIME_NULL, diff) > 0);
}
It's more convenient to pass parameters in order, like t2 - t1, when t2 is supposed to be more. Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> --- example/generator/odp_generator.c | 2 +- include/odp/api/time.h | 4 ++-- platform/linux-generic/odp_schedule.c | 2 +- platform/linux-generic/odp_time.c | 2 +- test/performance/odp_pktio_perf.c | 10 +++++----- test/validation/pktio/pktio.c | 4 ++-- test/validation/time/time.c | 4 ++-- 7 files changed, 14 insertions(+), 14 deletions(-)