@@ -106,7 +106,7 @@ struct tx_stats_s {
uint64_t tx_cnt; /* Packets transmitted */
uint64_t alloc_failures;/* Packet allocation failures */
uint64_t enq_failures; /* Enqueue failures */
- odp_time_t idle_cycles; /* Idle cycle count in TX loop */
+ odp_time_t idle_ticks; /* Idle ticks count in TX loop */
};
typedef union tx_stats_u {
@@ -305,8 +305,8 @@ static void *run_thread_tx(void *arg)
int thr_id;
odp_queue_t outq;
pkt_tx_stats_t *stats;
- odp_time_t start_cycles, cur_cycles, send_duration;
- odp_time_t burst_start_cycles, burst_gap_cycles;
+ odp_time_t start_time, cur_time, send_duration;
+ odp_time_t burst_start_time, burst_gap;
uint32_t batch_len;
int unsent_pkts = 0;
odp_event_t tx_event[BATCH_LEN_MAX];
@@ -328,36 +328,35 @@ static void *run_thread_tx(void *arg)
if (outq == ODP_QUEUE_INVALID)
LOG_ABORT("Failed to get output queue for thread %d\n", thr_id);
- burst_gap_cycles = odp_time_from_ns(
+ burst_gap = odp_time_from_ns(
ODP_TIME_SEC / (targs->pps / targs->batch_len));
send_duration = odp_time_from_ns(targs->duration * ODP_TIME_SEC);
odp_barrier_wait(&globals->tx_barrier);
- cur_cycles = odp_time();
- start_cycles = cur_cycles;
- burst_start_cycles = odp_time_diff(burst_gap_cycles, cur_cycles);
- while (odp_time_diff(start_cycles, cur_cycles) < send_duration) {
+ cur_time = odp_time();
+ start_time = cur_time;
+ burst_start_time = odp_time_diff(burst_gap, cur_time);
+ while (odp_time_diff(start_time, cur_time) < send_duration) {
unsigned alloc_cnt = 0, tx_cnt;
- if (odp_time_diff(burst_start_cycles, cur_cycles)
- < burst_gap_cycles) {
- cur_cycles = odp_time();
+ if (odp_time_diff(burst_start_time, cur_time) < burst_gap) {
+ cur_time = odp_time();
if (!odp_time_cmp(ODP_TIME_NULL, idle_start))
- idle_start = cur_cycles;
+ idle_start = cur_time;
continue;
}
if (odp_time_cmp(ODP_TIME_NULL, idle_start)) {
- odp_time_t diff = odp_time_diff(idle_start, cur_cycles);
+ odp_time_t diff = odp_time_diff(idle_start, cur_time);
- stats->s.idle_cycles =
- odp_time_sum(diff, stats->s.idle_cycles);
+ stats->s.idle_ticks =
+ odp_time_sum(diff, stats->s.idle_ticks);
idle_start = ODP_TIME_NULL;
}
- burst_start_cycles += burst_gap_cycles;
+ burst_start_time += burst_gap;
alloc_cnt = alloc_packets(tx_event, batch_len - unsent_pkts);
if (alloc_cnt != batch_len)
@@ -368,14 +367,14 @@ static void *run_thread_tx(void *arg)
stats->s.enq_failures += unsent_pkts;
stats->s.tx_cnt += tx_cnt;
- cur_cycles = odp_time();
+ cur_time = odp_time();
}
VPRINT(" %02d: TxPkts %-8"PRIu64" EnqFail %-6"PRIu64
" AllocFail %-6"PRIu64" Idle %"PRIu64"ms\n",
thr_id, stats->s.tx_cnt,
stats->s.enq_failures, stats->s.alloc_failures,
- odp_time_to_ns(stats->s.idle_cycles) / (uint64_t)ODP_TIME_MSEC);
+ odp_time_to_ns(stats->s.idle_ticks) / (uint64_t)ODP_TIME_MSEC);
return NULL;
}
@@ -465,11 +465,10 @@ static void *schedule_common_(void *arg)
CU_ASSERT(from != ODP_QUEUE_INVALID);
if (locked) {
int cnt;
- odp_time_t cycles = ODP_TIME_NULL;
+ odp_time_t ticks = ODP_TIME_NULL;
/* Do some work here to keep the thread busy */
for (cnt = 0; cnt < 1000; cnt++)
- cycles = odp_time_sum(cycles,
- odp_time());
+ ticks = odp_time_sum(ticks, odp_time());
odp_spinlock_unlock(&globals->atomic_lock);
}
@@ -11,49 +11,49 @@
#define TOLERANCE 1
#define BUSY_LOOP_CNT 100
-/* check that a cycles difference gives a reasonable result */
-void time_test_odp_cycles_diff(void)
+/* check that a time difference gives a reasonable result */
+void time_test_odp_diff(void)
{
/* volatile to stop optimization of busy loop */
volatile int count = 0;
- odp_time_t diff, cycles1, cycles2;
+ odp_time_t diff, t1, t2;
- cycles1 = odp_time();
+ t1 = odp_time();
while (count < BUSY_LOOP_CNT) {
count++;
};
- cycles2 = odp_time();
- CU_ASSERT((odp_time_cmp(cycles1, cycles2) > 0));
+ t2 = odp_time();
+ CU_ASSERT(odp_time_cmp(t1, t2) > 0);
- diff = odp_time_diff(cycles1, cycles2);
+ diff = odp_time_diff(t1, t2);
CU_ASSERT(odp_time_cmp(ODP_TIME_NULL, diff) > 0);
}
-/* check that a negative cycles difference gives a reasonable result */
-void time_test_odp_cycles_negative_diff(void)
+/* check that a negative time difference gives a reasonable result */
+void time_test_odp_negative_diff(void)
{
- odp_time_t diff, cycles1, cycles2;
+ odp_time_t diff, t1, t2;
- cycles1 = 10;
- cycles2 = 5;
- diff = odp_time_diff(cycles1, cycles2);
+ t1 = 10;
+ t2 = 5;
+ diff = odp_time_diff(t1, t2);
CU_ASSERT(odp_time_cmp(ODP_TIME_NULL, diff) > 0);
}
/* check that related conversions come back to the same value */
-void time_test_odp_time_conversion(void)
+void time_test_odp_conversion(void)
{
uint64_t ns1, ns2;
- odp_time_t cycles;
+ odp_time_t time;
uint64_t upper_limit, lower_limit;
ns1 = 100;
- cycles = odp_time_from_ns(ns1);
- CU_ASSERT(odp_time_cmp(ODP_TIME_NULL, cycles) > 0);
+ time = odp_time_from_ns(ns1);
+ CU_ASSERT(odp_time_cmp(ODP_TIME_NULL, time) > 0);
- ns2 = odp_time_to_ns(cycles);
+ ns2 = odp_time_to_ns(time);
/* need to check within arithmetic tolerance that the same
* value in ns is returned after conversions */
@@ -63,9 +63,9 @@ void time_test_odp_time_conversion(void)
}
CU_TestInfo time_suite_time[] = {
- _CU_TEST_INFO(time_test_odp_cycles_diff),
- _CU_TEST_INFO(time_test_odp_cycles_negative_diff),
- _CU_TEST_INFO(time_test_odp_time_conversion),
+ _CU_TEST_INFO(time_test_odp_diff),
+ _CU_TEST_INFO(time_test_odp_negative_diff),
+ _CU_TEST_INFO(time_test_odp_conversion),
CU_TEST_INFO_NULL
};
@@ -10,9 +10,9 @@
#include <CUnit/Basic.h>
/* test functions: */
-void time_test_odp_cycles_diff(void);
-void time_test_odp_cycles_negative_diff(void);
-void time_test_odp_time_conversion(void);
+void time_test_odp_diff(void);
+void time_test_odp_conversion(void);
+void time_test_odp_negative_diff(void);
/* test arrays: */
extern CU_TestInfo time_suite_time[];
The word "cycle" is left from old API time names. The "cycle" is ambiguous word, especially when it can be used for other purposes. So better to use "tick" or "time" word or just "t" symbol. Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> --- test/performance/odp_pktio_perf.c | 35 ++++++++++++++--------------- test/validation/scheduler/scheduler.c | 5 ++--- test/validation/time/time.c | 42 +++++++++++++++++------------------ test/validation/time/time.h | 6 ++--- 4 files changed, 43 insertions(+), 45 deletions(-)