From patchwork Wed Aug 5 21:01:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 51975 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by patches.linaro.org (Postfix) with ESMTPS id 79E5F229FD for ; Wed, 5 Aug 2015 21:03:15 +0000 (UTC) Received: by labth1 with SMTP id th1sf19890895lab.2 for ; Wed, 05 Aug 2015 14:03:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:delivered-to:from:to:date :message-id:in-reply-to:references:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :mime-version:content-type:content-transfer-encoding:errors-to :sender:x-original-sender:x-original-authentication-results :mailing-list; bh=dKrNoU2a92iBrdbyn2nENxJj99NoeKLGfnMZQcV9PYM=; b=K8JNhVjuvTlVIJpZ7I0Yz0dVPHPJV6c9EbBKU9HwKUjam6NSmPVHAdYhwnVHcSBI2j ny6d7LeO6jbCTEhTj97DOlpCD1roHghfz5zVktI4Ou/mlV+Bn3BNzZjo/QZVn4zz5Nw2 mek6opUiITbCftVm55jUkk44hq9ORrDN/3tiAKLReere6Tzeik/vXoI7Nug+alDNMCAQ ltPSF9UWJAUKhawFWt8cuPmfdbNUDm5D+4bFOUqTtyMSHzNJsxHSjp4uMtgZbCjoWxsV 1UrR/jvnB3D0CtrHJFfbvu49dh96NUAi7/MJ7ZbdjUkDb7gqF5csGp0khRlQygMl88qY nNUA== X-Gm-Message-State: ALoCoQmbdIo6lEsWAcaq0ig6GVJ6pQgMe91FnEgMnfibGcpqS67e0dzEUjnbptLdZ/eagnCtJ3pA X-Received: by 10.180.83.226 with SMTP id t2mr168371wiy.5.1438808594402; Wed, 05 Aug 2015 14:03:14 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.7.146 with SMTP id j18ls236761laa.44.gmail; Wed, 05 Aug 2015 14:03:14 -0700 (PDT) X-Received: by 10.112.151.178 with SMTP id ur18mr11439391lbb.59.1438808594228; Wed, 05 Aug 2015 14:03:14 -0700 (PDT) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com. [209.85.215.54]) by mx.google.com with ESMTPS id iz3si2963185lbc.174.2015.08.05.14.03.14 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Aug 2015 14:03:14 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by labgo9 with SMTP id go9so36721982lab.3 for ; Wed, 05 Aug 2015 14:03:14 -0700 (PDT) X-Received: by 10.112.120.134 with SMTP id lc6mr11357572lbb.86.1438808594027; Wed, 05 Aug 2015 14:03:14 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.7.198 with SMTP id l6csp575339lba; Wed, 5 Aug 2015 14:03:12 -0700 (PDT) X-Received: by 10.140.104.236 with SMTP id a99mr20763120qgf.71.1438808592612; Wed, 05 Aug 2015 14:03:12 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id j12si7676281qkh.49.2015.08.05.14.03.11; Wed, 05 Aug 2015 14:03:12 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Received: by lists.linaro.org (Postfix, from userid 109) id D4B5062069; Wed, 5 Aug 2015 21:03:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from ip-10-142-244-252.ec2.internal (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id AB19F6206D; Wed, 5 Aug 2015 21:01:40 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id E23C96206E; Wed, 5 Aug 2015 21:01:29 +0000 (UTC) Received: from mail-wi0-f179.google.com (mail-wi0-f179.google.com [209.85.212.179]) by lists.linaro.org (Postfix) with ESMTPS id 81CBB62068 for ; Wed, 5 Aug 2015 21:01:24 +0000 (UTC) Received: by wicgj17 with SMTP id gj17so208319235wic.1 for ; Wed, 05 Aug 2015 14:01:23 -0700 (PDT) X-Received: by 10.180.94.168 with SMTP id dd8mr2442091wib.76.1438808483711; Wed, 05 Aug 2015 14:01:23 -0700 (PDT) Received: from khorivan.synapse.com (46-148-93-178.pool.ukrtel.net. [178.93.148.46]) by smtp.gmail.com with ESMTPSA id rz9sm5931423wjb.8.2015.08.05.14.01.22 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 05 Aug 2015 14:01:23 -0700 (PDT) From: Ivan Khoronzhuk To: lng-odp@lists.linaro.org Date: Thu, 6 Aug 2015 00:01:11 +0300 Message-Id: <1438808473-26968-3-git-send-email-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1438808473-26968-1-git-send-email-ivan.khoronzhuk@linaro.org> References: <1438808473-26968-1-git-send-email-ivan.khoronzhuk@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCH 2/4] test/example: avoid "cycle" word usage X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ivan.khoronzhuk@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 The word "cycle" is left from old API time names. The "cycle" is ambiguous word, especially when it can be used with software cycles. So better to use "time" word or just "t" symbol, as no matter in which units time is measured, in sec, hours, cycles or counts. Signed-off-by: Ivan Khoronzhuk --- example/ipsec/odp_ipsec.c | 14 +++--- example/timer/odp_timer_test.c | 22 +++++----- test/performance/odp_pktio_perf.c | 38 ++++++++-------- test/performance/odp_scheduling.c | 82 +++++++++++++++++------------------ test/validation/scheduler/scheduler.c | 4 +- test/validation/time/time.c | 38 ++++++++-------- 6 files changed, 99 insertions(+), 99 deletions(-) diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index 8a18322..f431e53 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -265,11 +265,11 @@ odp_queue_t polled_odp_queue_create(const char *name, static odp_event_t polled_odp_schedule(odp_queue_t *from, uint64_t wait) { - uint64_t start_cycle; - uint64_t cycle; + uint64_t start_time; + uint64_t time; uint64_t diff; - start_cycle = 0; + start_time = 0; while (1) { int idx; @@ -292,13 +292,13 @@ odp_event_t polled_odp_schedule(odp_queue_t *from, uint64_t wait) if (ODP_SCHED_NO_WAIT == wait) break; - if (0 == start_cycle) { - start_cycle = odp_time_counts(); + if (0 == start_time) { + start_time = odp_time_counts(); continue; } - cycle = odp_time_counts(); - diff = odp_time_diff_counts(start_cycle, cycle); + time = odp_time_counts(); + diff = odp_time_diff_counts(start_time, time); if (wait < diff) break; diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c index ace280b..b6507c3 100644 --- a/example/timer/odp_timer_test.c +++ b/example/timer/odp_timer_test.c @@ -313,7 +313,7 @@ int main(int argc, char *argv[]) odph_linux_pthread_t thread_tbl[MAX_WORKERS]; int num_workers; odp_queue_t queue; - uint64_t cycles, ns; + uint64_t counts, ns; odp_queue_param_t param; odp_pool_param_t params; odp_timer_pool_param_t tparams; @@ -438,21 +438,21 @@ int main(int argc, char *argv[]) } printf("CPU freq %"PRIu64" Hz\n", odp_sys_cpu_hz()); - printf("Cycles vs nanoseconds:\n"); + printf("Counts vs nanoseconds:\n"); ns = 0; - cycles = odp_time_ns_to_counts(ns); + counts = odp_time_ns_to_counts(ns); - printf(" %12"PRIu64" ns -> %12"PRIu64" cycles\n", ns, cycles); - printf(" %12"PRIu64" cycles -> %12"PRIu64" ns\n", cycles, - odp_time_counts_to_ns(cycles)); + printf(" %12"PRIu64" ns -> %12"PRIu64" counts\n", ns, counts); + printf(" %12"PRIu64" counts -> %12"PRIu64" ns\n", counts, + odp_time_counts_to_ns(counts)); for (ns = 1; ns <= 100*ODP_TIME_SEC; ns *= 10) { - cycles = odp_time_ns_to_counts(ns); + counts = odp_time_ns_to_counts(ns); - printf(" %12"PRIu64" ns -> %12"PRIu64" cycles\n", ns, - cycles); - printf(" %12"PRIu64" cycles -> %12"PRIu64" ns\n", cycles, - odp_time_counts_to_ns(cycles)); + printf(" %12"PRIu64" ns -> %12"PRIu64" counts\n", ns, + counts); + printf(" %12"PRIu64" counts -> %12"PRIu64" ns\n", counts, + odp_time_counts_to_ns(counts)); } printf("\n"); diff --git a/test/performance/odp_pktio_perf.c b/test/performance/odp_pktio_perf.c index 0574536..8df078d 100644 --- a/test/performance/odp_pktio_perf.c +++ b/test/performance/odp_pktio_perf.c @@ -103,10 +103,10 @@ typedef union rx_stats_u { } pkt_rx_stats_t; struct tx_stats_s { - uint64_t tx_cnt; /* Packets transmitted */ - uint64_t alloc_failures;/* Packet allocation failures */ - uint64_t enq_failures; /* Enqueue failures */ - uint64_t idle_cycles; /* Idle cycle count in TX loop */ + uint64_t tx_cnt; /* Packets transmitted */ + uint64_t alloc_failures; /* Packet allocation failures */ + uint64_t enq_failures; /* Enqueue failures */ + uint64_t idle_time; /* Idle time count in TX loop */ }; typedef union tx_stats_u { @@ -302,8 +302,8 @@ static void *run_thread_tx(void *arg) int thr_id; odp_queue_t outq; pkt_tx_stats_t *stats; - uint64_t next_tx_cycles, end_cycles, cur_cycles; - uint64_t burst_gap_cycles; + uint64_t next_tx_time, end_time, cur_time; + uint64_t burst_gap_time; uint32_t batch_len; int unsent_pkts = 0; odp_event_t tx_event[BATCH_LEN_MAX]; @@ -325,33 +325,33 @@ 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_ns_to_counts( + burst_gap_time = odp_time_ns_to_counts( ODP_TIME_SEC / (targs->pps / targs->batch_len)); odp_barrier_wait(&globals->tx_barrier); - cur_cycles = odp_time_counts(); - next_tx_cycles = cur_cycles; - end_cycles = cur_cycles + + cur_time = odp_time_counts(); + next_tx_time = cur_time; + end_time = cur_time + odp_time_ns_to_counts(targs->duration * ODP_TIME_SEC); - while (cur_cycles < end_cycles) { + while (cur_time < end_time) { unsigned alloc_cnt = 0, tx_cnt; - if (cur_cycles < next_tx_cycles) { - cur_cycles = odp_time_counts(); + if (cur_time < next_tx_time) { + cur_time = odp_time_counts(); if (idle_start == 0) - idle_start = cur_cycles; + idle_start = cur_time; continue; } if (idle_start) { - stats->s.idle_cycles += odp_time_diff_counts( - idle_start, cur_cycles); + stats->s.idle_time += odp_time_diff_counts( + idle_start, cur_time); idle_start = 0; } - next_tx_cycles += burst_gap_cycles; + next_tx_time += burst_gap_time; alloc_cnt = alloc_packets(tx_event, batch_len - unsent_pkts); if (alloc_cnt != batch_len) @@ -362,14 +362,14 @@ static void *run_thread_tx(void *arg) stats->s.enq_failures += unsent_pkts; stats->s.tx_cnt += tx_cnt; - cur_cycles = odp_time_counts(); + cur_time = odp_time_counts(); } 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_counts_to_ns(stats->s.idle_cycles) / 1000 / 1000); + odp_time_counts_to_ns(stats->s.idle_time) / 1000 / 1000); return NULL; } diff --git a/test/performance/odp_scheduling.c b/test/performance/odp_scheduling.c index 3969111..98c5e43 100644 --- a/test/performance/odp_scheduling.c +++ b/test/performance/odp_scheduling.c @@ -183,7 +183,7 @@ static int test_alloc_single(int thr, odp_pool_t pool) { int i; odp_buffer_t temp_buf; - uint64_t t1, t2, cycles, ns; + uint64_t t1, t2, tdiff, ns; t1 = odp_time_counts(); @@ -199,11 +199,11 @@ static int test_alloc_single(int thr, odp_pool_t pool) } t2 = odp_time_counts(); - cycles = odp_time_diff_counts(t1, t2); - ns = odp_time_counts_to_ns(cycles); + tdiff = odp_time_diff_counts(t1, t2); + ns = odp_time_counts_to_ns(tdiff); - printf(" [%i] alloc_sng alloc+free %"PRIu64" cycles, %"PRIu64" ns\n", - thr, cycles/ALLOC_ROUNDS, ns/ALLOC_ROUNDS); + printf(" [%i] alloc_sng alloc+free %"PRIu64" counts, %"PRIu64" ns\n", + thr, tdiff / ALLOC_ROUNDS, ns / ALLOC_ROUNDS); return 0; } @@ -220,7 +220,7 @@ static int test_alloc_multi(int thr, odp_pool_t pool) { int i, j; odp_buffer_t temp_buf[MAX_ALLOCS]; - uint64_t t1, t2, cycles, ns; + uint64_t t1, t2, tdiff, ns; t1 = odp_time_counts(); @@ -239,11 +239,11 @@ static int test_alloc_multi(int thr, odp_pool_t pool) } t2 = odp_time_counts(); - cycles = odp_time_diff_counts(t1, t2); - ns = odp_time_counts_to_ns(cycles); + tdiff = odp_time_diff_counts(t1, t2); + ns = odp_time_counts_to_ns(tdiff); - printf(" [%i] alloc_multi alloc+free %"PRIu64" cycles, %"PRIu64" ns\n", - thr, cycles/(ALLOC_ROUNDS*MAX_ALLOCS), + printf(" [%i] alloc_multi alloc+free %"PRIu64" counts, %"PRIu64" ns\n", + thr, tdiff / (ALLOC_ROUNDS * MAX_ALLOCS), ns/(ALLOC_ROUNDS*MAX_ALLOCS)); return 0; @@ -265,7 +265,7 @@ static int test_poll_queue(int thr, odp_pool_t msg_pool) odp_buffer_t buf; test_message_t *t_msg; odp_queue_t queue; - uint64_t t1, t2, cycles, ns; + uint64_t t1, t2, tdiff, ns; int i; /* Alloc test message */ @@ -311,11 +311,11 @@ static int test_poll_queue(int thr, odp_pool_t msg_pool) } t2 = odp_time_counts(); - cycles = odp_time_diff_counts(t1, t2); - ns = odp_time_counts_to_ns(cycles); + tdiff = odp_time_diff_counts(t1, t2); + ns = odp_time_counts_to_ns(tdiff); - printf(" [%i] poll_queue enq+deq %"PRIu64" cycles, %"PRIu64" ns\n", - thr, cycles/QUEUE_ROUNDS, ns/QUEUE_ROUNDS); + printf(" [%i] poll_queue enq+deq %"PRIu64" counts, %"PRIu64" ns\n", + thr, tdiff / QUEUE_ROUNDS, ns / QUEUE_ROUNDS); odp_buffer_free(buf); return 0; @@ -341,7 +341,7 @@ static int test_schedule_single(const char *str, int thr, { odp_event_t ev; odp_queue_t queue; - uint64_t t1, t2, cycles, ns; + uint64_t t1, t2, tdiff, ns; uint32_t i; uint32_t tot = 0; @@ -383,17 +383,17 @@ static int test_schedule_single(const char *str, int thr, odp_schedule_resume(); t2 = odp_time_counts(); - cycles = odp_time_diff_counts(t1, t2); - ns = odp_time_counts_to_ns(cycles); + tdiff = odp_time_diff_counts(t1, t2); + ns = odp_time_counts_to_ns(tdiff); odp_barrier_wait(barrier); clear_sched_queues(); - cycles = cycles/tot; + tdiff = tdiff / tot; ns = ns/tot; - printf(" [%i] %s enq+deq %"PRIu64" cycles, %"PRIu64" ns\n", - thr, str, cycles, ns); + printf(" [%i] %s enq+deq %"PRIu64" counts, %"PRIu64" ns\n", + thr, str, tdiff, ns); return 0; } @@ -421,7 +421,7 @@ static int test_schedule_many(const char *str, int thr, odp_queue_t queue; uint64_t t1 = 0; uint64_t t2 = 0; - uint64_t cycles, ns; + uint64_t tdiff, ns; uint32_t i; uint32_t tot = 0; @@ -464,17 +464,17 @@ static int test_schedule_many(const char *str, int thr, odp_schedule_resume(); t2 = odp_time_counts(); - cycles = odp_time_diff_counts(t1, t2); - ns = odp_time_counts_to_ns(cycles); + tdiff = odp_time_diff_counts(t1, t2); + ns = odp_time_counts_to_ns(tdiff); odp_barrier_wait(barrier); clear_sched_queues(); - cycles = cycles/tot; + tdiff = tdiff / tot; ns = ns/tot; - printf(" [%i] %s enq+deq %"PRIu64" cycles, %"PRIu64" ns\n", - thr, str, cycles, ns); + printf(" [%i] %s enq+deq %"PRIu64" counts, %"PRIu64" ns\n", + thr, str, tdiff, ns); return 0; } @@ -498,7 +498,7 @@ static int test_schedule_multi(const char *str, int thr, odp_queue_t queue; uint64_t t1 = 0; uint64_t t2 = 0; - uint64_t cycles, ns; + uint64_t tdiff, ns; int i, j; int num; uint32_t tot = 0; @@ -585,22 +585,22 @@ static int test_schedule_multi(const char *str, int thr, t2 = odp_time_counts(); - cycles = odp_time_diff_counts(t1, t2); - ns = odp_time_counts_to_ns(cycles); + tdiff = odp_time_diff_counts(t1, t2); + ns = odp_time_counts_to_ns(tdiff); odp_barrier_wait(barrier); clear_sched_queues(); if (tot) { - cycles = cycles/tot; + tdiff = tdiff / tot; ns = ns/tot; } else { - cycles = 0; + tdiff = 0; ns = 0; } - printf(" [%i] %s enq+deq %"PRIu64" cycles, %"PRIu64" ns\n", - thr, str, cycles, ns); + printf(" [%i] %s enq+deq %"PRIu64" counts, %"PRIu64" ns\n", + thr, str, tdiff, ns); return 0; } @@ -714,13 +714,13 @@ static void *run_thread(void *arg) } /** - * @internal Test cycle counter accuracy + * @internal Test time counter accuracy */ static void test_time(void) { struct timespec tp1, tp2; uint64_t t1, t2; - uint64_t ns1, ns2, cycles; + uint64_t ns1, ns2, tdiff; double err; if (clock_gettime(CLOCK_MONOTONIC, &tp2)) { @@ -757,15 +757,15 @@ static void test_time(void) else ns1 -= tp1.tv_nsec - tp2.tv_nsec; - cycles = odp_time_diff_counts(t1, t2); - ns2 = odp_time_counts_to_ns(cycles); + tdiff = odp_time_diff_counts(t1, t2); + ns2 = odp_time_counts_to_ns(tdiff); err = ((double)(ns2) - (double)ns1) / (double)ns1; printf("clock_gettime %"PRIu64" ns\n", ns1); - printf("odp_time_counts %"PRIu64" cycles\n", cycles); + printf("odp_time_counts %"PRIu64" counts\n", tdiff); printf("odp_time_counts_to_ns %"PRIu64" ns\n", ns2); - printf("odp get cycle error %f%%\n", err*100.0); + printf("odp get count error %f%%\n", err * 100.0); printf("\n"); } @@ -898,7 +898,7 @@ int main(int argc, char *argv[]) printf("first CPU: %i\n", odp_cpumask_first(&cpumask)); printf("cpu mask: %s\n", cpumaskstr); - /* Test cycle count accuracy */ + /* Test time count accuracy */ test_time(); shm = odp_shm_reserve("test_globals", diff --git a/test/validation/scheduler/scheduler.c b/test/validation/scheduler/scheduler.c index 22d19a6..9db456c 100644 --- a/test/validation/scheduler/scheduler.c +++ b/test/validation/scheduler/scheduler.c @@ -212,10 +212,10 @@ static void *schedule_common_(void *arg) CU_ASSERT(from != ODP_QUEUE_INVALID); if (locked) { int cnt; - uint64_t cycles = 0; + uint64_t time = 0; /* Do some work here to keep the thread busy */ for (cnt = 0; cnt < 1000; cnt++) - cycles += odp_time_counts(); + time += odp_time_counts(); odp_spinlock_unlock(&globals->atomic_lock); } diff --git a/test/validation/time/time.c b/test/validation/time/time.c index 8ef7f2a..952d78a 100644 --- a/test/validation/time/time.c +++ b/test/validation/time/time.c @@ -11,48 +11,48 @@ #define TOLERANCE 1 #define BUSY_LOOP_CNT 100 -/* check that a cycles difference gives a reasonable result */ -static void time_test_odp_cycles_diff(void) +/* check that a counts difference gives a reasonable result */ +static void time_test_odp_counts_diff(void) { /* volatile to stop optimization of busy loop */ volatile int count = 0; - uint64_t diff, cycles1, cycles2; + uint64_t diff, counts1, counts2; - cycles1 = odp_time_counts(); + counts1 = odp_time_counts(); while (count < BUSY_LOOP_CNT) { count++; }; - cycles2 = odp_time_counts(); - CU_ASSERT(cycles2 > cycles1); + counts2 = odp_time_counts(); + CU_ASSERT(counts2 > counts1); - diff = odp_time_diff_counts(cycles1, cycles2); + diff = odp_time_diff_counts(counts1, counts2); CU_ASSERT(diff > 0); } -/* check that a negative cycles difference gives a reasonable result */ -static void time_test_odp_cycles_negative_diff(void) +/* check that a negative counts difference gives a reasonable result */ +static void time_test_odp_counts_negative_diff(void) { - uint64_t diff, cycles1, cycles2; + uint64_t diff, counts1, counts2; - cycles1 = 10; - cycles2 = 5; - diff = odp_time_diff_counts(cycles1, cycles2); + counts1 = 10; + counts2 = 5; + diff = odp_time_diff_counts(counts1, counts2); CU_ASSERT(diff > 0); } /* check that related conversions come back to the same value */ static void time_test_odp_time_conversion(void) { - uint64_t ns1, ns2, cycles; + uint64_t ns1, ns2, counts; uint64_t upper_limit, lower_limit; ns1 = 100; - cycles = odp_time_ns_to_counts(ns1); - CU_ASSERT(cycles > 0); + counts = odp_time_ns_to_counts(ns1); + CU_ASSERT(counts > 0); - ns2 = odp_time_counts_to_ns(cycles); + ns2 = odp_time_counts_to_ns(counts); /* need to check within arithmetic tolerance that the same * value in ns is returned after conversions */ @@ -62,8 +62,8 @@ static void time_test_odp_time_conversion(void) } CU_TestInfo time_suite_time[] = { - {"cycles diff", time_test_odp_cycles_diff}, - {"negative diff", time_test_odp_cycles_negative_diff}, + {"counts diff", time_test_odp_counts_diff}, + {"negative diff", time_test_odp_counts_negative_diff}, {"conversion", time_test_odp_time_conversion}, CU_TEST_INFO_NULL };