From patchwork Wed Sep 2 21:10:52 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 52994 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by patches.linaro.org (Postfix) with ESMTPS id 9355D22E23 for ; Wed, 2 Sep 2015 21:14:29 +0000 (UTC) Received: by wicgc1 with SMTP id gc1sf10790340wic.3 for ; Wed, 02 Sep 2015 14:14:28 -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=SGRyv0Gi3+dfBbosCXhjUmj4PcpoPMY68Bgx4sGO2cY=; b=ZQcMU6zy2fQhZV9TXvFAczs9h4aOC70srLT9cpEFD7y8hYUDOuiOyzrUYLUW6cI8QC AWSJPwtl+SCIi239UfAq7GR3Oor0ScDUcTR6nDNXxpY1PhBp56le3OU9hwWG9tZ4bArD +YYgacXcpmzfNrAHeRnlJxd/gGnZI9GKHCfC+nG2WNVlbR/G0u9N/l8swcMux5jpfIv4 tsrm3nXIqNLC5zI6qmNXVKKdZmjpv1xJCFmRYRMc8zCRMtdOgK53moFRqEdMahd0aptB In1qoybn6XJuz4pma6LnmiJkip41S9QczwCA0aIycYNf6wSU/3OMZDG6jb07Gn1SmcWf nCkg== X-Gm-Message-State: ALoCoQlb1nyOAFMgmn0vkd7FMbJ/RP7OGBB0YMAmHDyHrWHSti3s3Upm6DLbR21P0N2xl3Gj/ug1 X-Received: by 10.180.79.66 with SMTP id h2mr1596792wix.3.1441228468830; Wed, 02 Sep 2015 14:14:28 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.6.196 with SMTP id d4ls157392laa.91.gmail; Wed, 02 Sep 2015 14:14:28 -0700 (PDT) X-Received: by 10.152.237.34 with SMTP id uz2mr5621320lac.84.1441228468643; Wed, 02 Sep 2015 14:14:28 -0700 (PDT) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com. [209.85.217.177]) by mx.google.com with ESMTPS id b8si20949984lbg.101.2015.09.02.14.14.28 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Sep 2015 14:14:28 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) client-ip=209.85.217.177; Received: by lbcao8 with SMTP id ao8so13682948lbc.3 for ; Wed, 02 Sep 2015 14:14:28 -0700 (PDT) X-Received: by 10.152.26.163 with SMTP id m3mr18139240lag.86.1441228468350; Wed, 02 Sep 2015 14:14:28 -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.164.42 with SMTP id yn10csp840522lbb; Wed, 2 Sep 2015 14:14:27 -0700 (PDT) X-Received: by 10.140.46.37 with SMTP id j34mr601832qga.72.1441228466934; Wed, 02 Sep 2015 14:14:26 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 184si14921858qhq.79.2015.09.02.14.14.26; Wed, 02 Sep 2015 14:14:26 -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 2180E619CB; Wed, 2 Sep 2015 21:14:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 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 [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 37BCD619DE; Wed, 2 Sep 2015 21:11:35 +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 E8F3B619CB; Wed, 2 Sep 2015 21:11:19 +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 4A59D617FD for ; Wed, 2 Sep 2015 21:11:12 +0000 (UTC) Received: by wiclp12 with SMTP id lp12so32095052wic.1 for ; Wed, 02 Sep 2015 14:11:11 -0700 (PDT) X-Received: by 10.194.238.39 with SMTP id vh7mr42169261wjc.109.1441228271108; Wed, 02 Sep 2015 14:11:11 -0700 (PDT) Received: from khorivan.synapse.com ([212.90.60.8]) by smtp.gmail.com with ESMTPSA id lg6sm34271216wjb.10.2015.09.02.14.11.09 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 02 Sep 2015 14:11:09 -0700 (PDT) From: Ivan Khoronzhuk To: lng-odp@lists.linaro.org Date: Thu, 3 Sep 2015 00:10:52 +0300 Message-Id: <1441228253-21225-3-git-send-email-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1441228253-21225-1-git-send-email-ivan.khoronzhuk@linaro.org> References: <1441228253-21225-1-git-send-email-ivan.khoronzhuk@linaro.org> X-Topics: patch Subject: [lng-odp] [odp-lng] [Patch v3 2/3] 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.217.177 as permitted sender) smtp.mailfrom=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 for other purposes. So better to use "tick" or "time" word or just "t" symbol. Signed-off-by: Ivan Khoronzhuk --- example/generator/odp_generator.c | 12 ++--- example/timer/odp_timer_test.c | 24 +++++----- test/performance/odp_pktio_perf.c | 39 +++++++++-------- test/performance/odp_scheduling.c | 82 +++++++++++++++++------------------ test/validation/scheduler/scheduler.c | 5 +-- test/validation/time/time.c | 42 +++++++++--------- test/validation/time/time.h | 6 +-- 7 files changed, 105 insertions(+), 105 deletions(-) diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index f7aed76..46ddf11 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -585,7 +585,7 @@ static void *gen_recv_thread(void *arg) */ static void print_global_stats(int num_workers) { - uint64_t start, now, diff; + odp_time_t start, now, diff; uint64_t pkts, pkts_prev = 0, pps, maximum_pps = 0; int verbose_interval = 20; odp_thrmask_t thrd_mask; @@ -593,7 +593,7 @@ static void print_global_stats(int num_workers) while (odp_thrmask_worker(&thrd_mask) < num_workers) continue; - start = odp_time_cycles(); + start = odp_time(); while (odp_thrmask_worker(&thrd_mask) == num_workers) { if (args->appl.number != -1 && @@ -602,14 +602,14 @@ static void print_global_stats(int num_workers) break; } - now = odp_time_cycles(); - diff = odp_time_diff_cycles(start, now); - if (odp_time_cycles_to_ns(diff) < + now = odp_time(); + diff = odp_time_diff(start, now); + if (odp_time_to_ns(diff) < verbose_interval * ODP_TIME_SEC) { continue; } - start = odp_time_cycles(); + start = odp_time(); if (args->appl.mode == APPL_MODE_RCV) { pkts = odp_atomic_load_u64(&counters.udp); diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c index 23c5a9a..58c215e 100644 --- a/example/timer/odp_timer_test.c +++ b/example/timer/odp_timer_test.c @@ -323,7 +323,7 @@ int main(int argc, char *argv[]) uint64_t ns; int num_workers; odp_queue_t queue; - odp_time_t cycles; + odp_time_t ticks; odp_queue_param_t param; odp_pool_param_t params; odp_timer_pool_param_t tparams; @@ -448,22 +448,22 @@ int main(int argc, char *argv[]) } printf("CPU freq %"PRIu64" Hz\n", odp_sys_cpu_hz()); - printf("Cycles vs nanoseconds:\n"); + printf("Ticks vs nanoseconds:\n"); ns = 0; - cycles = odp_time_from_ns(ns); + ticks = odp_time_from_ns(ns); - printf(" %12" PRIu64 " ns -> %12" PRIu64 " cycles\n", ns, - odp_time_to_u64(cycles)); - printf(" %12" PRIu64 " cycles -> %12" PRIu64 " ns\n", - odp_time_to_u64(cycles), odp_time_to_ns(cycles)); + printf(" %12" PRIu64 " ns -> %12" PRIu64 " ticks\n", ns, + odp_time_to_u64(ticks)); + printf(" %12" PRIu64 " ticks -> %12" PRIu64 " ns\n", + odp_time_to_u64(ticks), odp_time_to_ns(ticks)); for (ns = 1; ns <= 100*ODP_TIME_SEC; ns *= 10) { - cycles = odp_time_from_ns(ns); + ticks = odp_time_from_ns(ns); - printf(" %12" PRIu64 " ns -> %12" PRIu64 " cycles\n", ns, - odp_time_to_u64(cycles)); - printf(" %12" PRIu64 " cycles -> %12" PRIu64 " ns\n", - odp_time_to_u64(cycles), odp_time_to_ns(cycles)); + printf(" %12" PRIu64 " ns -> %12" PRIu64 " ticks\n", ns, + odp_time_to_u64(ticks)); + printf(" %12" PRIu64 " ticks -> %12" PRIu64 " ns\n", + odp_time_to_u64(ticks), odp_time_to_ns(ticks)); } printf("\n"); diff --git a/test/performance/odp_pktio_perf.c b/test/performance/odp_pktio_perf.c index b27efc8..3ecd042 100644 --- a/test/performance/odp_pktio_perf.c +++ b/test/performance/odp_pktio_perf.c @@ -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 { @@ -303,8 +303,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]; @@ -326,36 +326,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(cur_cycles, burst_gap_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(cur_time, burst_gap); + 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) @@ -366,14 +365,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; } @@ -591,11 +590,13 @@ static int setup_txrx_masks(odp_cpumask_t *thd_mask_tx, */ static void busy_loop_ns(uint64_t wait_ns) { + odp_time_t diff; odp_time_t start_time = odp_time(); odp_time_t wait = odp_time_from_ns(wait_ns); - while (odp_time_cmp(diff, wait) > 0) + do { diff = odp_time_diff(start_time, odp_time()); + } while (odp_time_cmp(diff, wait) > 0); } /* diff --git a/test/performance/odp_scheduling.c b/test/performance/odp_scheduling.c index 5859460..c100cb1 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; - odp_time_t t1, t2, cycles; + odp_time_t t1, t2, ticks; uint64_t ns; t1 = odp_time(); @@ -200,11 +200,11 @@ static int test_alloc_single(int thr, odp_pool_t pool) } t2 = odp_time(); - cycles = odp_time_diff(t1, t2); - ns = odp_time_to_ns(cycles); + ticks = odp_time_diff(t1, t2); + ns = odp_time_to_ns(ticks); - printf(" [%i] alloc_sng alloc+free %"PRIu64" cycles, %"PRIu64" ns\n", - thr, odp_time_to_u64(cycles) / ALLOC_ROUNDS, ns / ALLOC_ROUNDS); + printf(" [%i] alloc_sng alloc+free %" PRIu64 " ticks, %" PRIu64 " ns\n", + thr, odp_time_to_u64(ticks) / ALLOC_ROUNDS, ns / ALLOC_ROUNDS); return 0; } @@ -221,7 +221,7 @@ static int test_alloc_multi(int thr, odp_pool_t pool) { int i, j; odp_buffer_t temp_buf[MAX_ALLOCS]; - odp_time_t t1, t2, cycles; + odp_time_t t1, t2, ticks; uint64_t ns; t1 = odp_time(); @@ -241,11 +241,11 @@ static int test_alloc_multi(int thr, odp_pool_t pool) } t2 = odp_time(); - cycles = odp_time_diff(t1, t2); - ns = odp_time_to_ns(cycles); + ticks = odp_time_diff(t1, t2); + ns = odp_time_to_ns(ticks); - printf(" [%i] alloc_multi alloc+free %"PRIu64" cycles, %"PRIu64" ns\n", - thr, odp_time_to_u64(cycles) / (ALLOC_ROUNDS * MAX_ALLOCS), + printf(" [%i] alloc_multi alloc+free %" PRIu64 " ticks, %" PRIu64 " ns\n", + thr, odp_time_to_u64(ticks) / (ALLOC_ROUNDS * MAX_ALLOCS), ns/(ALLOC_ROUNDS*MAX_ALLOCS)); return 0; @@ -267,7 +267,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; - odp_time_t t1, t2, cycles; + odp_time_t t1, t2, ticks; uint64_t ns; int i; @@ -314,11 +314,11 @@ static int test_poll_queue(int thr, odp_pool_t msg_pool) } t2 = odp_time(); - cycles = odp_time_diff(t1, t2); - ns = odp_time_to_ns(cycles); + ticks = odp_time_diff(t1, t2); + ns = odp_time_to_ns(ticks); - printf(" [%i] poll_queue enq+deq %"PRIu64" cycles, %"PRIu64" ns\n", - thr, odp_time_to_u64(cycles) / QUEUE_ROUNDS, ns / QUEUE_ROUNDS); + printf(" [%i] poll_queue enq+deq %" PRIu64 " ticks, %" PRIu64 " ns\n", + thr, odp_time_to_u64(ticks) / QUEUE_ROUNDS, ns / QUEUE_ROUNDS); odp_buffer_free(buf); return 0; @@ -344,7 +344,7 @@ static int test_schedule_single(const char *str, int thr, { odp_event_t ev; odp_queue_t queue; - odp_time_t t1, t2, cycles; + odp_time_t t1, t2, ticks; uint64_t ns; uint32_t i; uint32_t tot; @@ -387,14 +387,14 @@ static int test_schedule_single(const char *str, int thr, odp_schedule_resume(); t2 = odp_time(); - cycles = odp_time_diff(t1, t2); - ns = odp_time_to_ns(cycles); + ticks = odp_time_diff(t1, t2); + ns = odp_time_to_ns(ticks); odp_barrier_wait(barrier); clear_sched_queues(); - printf(" [%i] %s enq+deq %"PRIu64" cycles, %"PRIu64" ns\n", - thr, str, odp_time_to_u64(cycles) / tot, ns / tot); + printf(" [%i] %s enq+deq %" PRIu64 " ticks, %" PRIu64 " ns\n", + thr, str, odp_time_to_u64(ticks) / tot, ns / tot); return 0; } @@ -420,7 +420,7 @@ static int test_schedule_many(const char *str, int thr, { odp_event_t ev; odp_queue_t queue; - odp_time_t t1, t2, cycles; + odp_time_t t1, t2, ticks; uint64_t ns; uint32_t i; uint32_t tot; @@ -464,14 +464,14 @@ static int test_schedule_many(const char *str, int thr, odp_schedule_resume(); t2 = odp_time(); - cycles = odp_time_diff(t1, t2); - ns = odp_time_to_ns(cycles); + ticks = odp_time_diff(t1, t2); + ns = odp_time_to_ns(ticks); odp_barrier_wait(barrier); clear_sched_queues(); - printf(" [%i] %s enq+deq %"PRIu64" cycles, %"PRIu64" ns\n", - thr, str, odp_time_to_u64(cycles) / tot, ns / tot); + printf(" [%i] %s enq+deq %" PRIu64 " ticks, %" PRIu64 " ns\n", + thr, str, odp_time_to_u64(ticks) / tot, ns / tot); return 0; } @@ -493,8 +493,8 @@ static int test_schedule_multi(const char *str, int thr, { odp_event_t ev[MULTI_BUFS_MAX]; odp_queue_t queue; - odp_time_t t1, t2, cycles; - uint64_t ns, cycles_pr; + odp_time_t t1, t2, ticks; + uint64_t ns, ticks_pr; int i, j; int num; uint32_t tot = 0; @@ -581,22 +581,22 @@ static int test_schedule_multi(const char *str, int thr, t2 = odp_time(); - cycles = odp_time_diff(t1, t2); - ns = odp_time_to_ns(cycles); + ticks = odp_time_diff(t1, t2); + ns = odp_time_to_ns(ticks); odp_barrier_wait(barrier); clear_sched_queues(); if (tot) { - cycles_pr = odp_time_to_u64(cycles) / tot; + ticks_pr = odp_time_to_u64(ticks) / tot; ns = ns/tot; } else { - cycles_pr = 0; + ticks_pr = 0; ns = 0; } - printf(" [%i] %s enq+deq %"PRIu64" cycles, %"PRIu64" ns\n", - thr, str, cycles_pr, ns); + printf(" [%i] %s enq+deq %" PRIu64 " ticks, %" PRIu64 " ns\n", + thr, str, ticks_pr, ns); return 0; } @@ -710,12 +710,12 @@ 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; - odp_time_t t1, t2, cycles; + odp_time_t t1, t2, ticks; uint64_t ns1, ns2; double err; @@ -753,16 +753,16 @@ static void test_time(void) else ns1 -= tp1.tv_nsec - tp2.tv_nsec; - cycles = odp_time_diff(t1, t2); - ns2 = odp_time_to_ns(cycles); + ticks = odp_time_diff(t1, t2); + ns2 = odp_time_to_ns(ticks); err = ((double)(ns2) - (double)ns1) / (double)ns1; printf("clock_gettime %"PRIu64" ns\n", ns1); - printf("odp_time %" PRIu64 " cycles\n", - odp_time_to_u64(cycles)); + printf("odp_time %" PRIu64 " ticks\n", + odp_time_to_u64(ticks)); printf("odp_time_to_ns %" PRIu64 " ns\n", ns2); - printf("odp get cycle error %f%%\n", err*100.0); + printf("odp get tick error %f%%\n", err * 100.0); printf("\n"); } @@ -895,7 +895,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 f94f0d0..12dff64 100644 --- a/test/validation/scheduler/scheduler.c +++ b/test/validation/scheduler/scheduler.c @@ -212,11 +212,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); } diff --git a/test/validation/time/time.c b/test/validation/time/time.c index f8dba8e..4cca319 100644 --- a/test/validation/time/time.c +++ b/test/validation/time/time.c @@ -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 }; diff --git a/test/validation/time/time.h b/test/validation/time/time.h index 1f69826..19a35df 100644 --- a/test/validation/time/time.h +++ b/test/validation/time/time.h @@ -10,9 +10,9 @@ #include /* 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[];