From patchwork Thu Nov 5 15:33:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 56065 Delivered-To: patch@linaro.org Received: by 10.112.61.134 with SMTP id p6csp477957lbr; Thu, 5 Nov 2015 07:39:55 -0800 (PST) X-Received: by 10.140.253.135 with SMTP id y129mr8698031qhc.20.1446737995675; Thu, 05 Nov 2015 07:39:55 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id l67si4879931qkh.74.2015.11.05.07.39.55; Thu, 05 Nov 2015 07:39:55 -0800 (PST) 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; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dkim=neutral (body hash did not verify) header.i=@linaro_org.20150623.gappssmtp.com Received: by lists.linaro.org (Postfix, from userid 109) id 224C761B18; Thu, 5 Nov 2015 15:39:55 +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.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID, 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 423D661A1B; Thu, 5 Nov 2015 15:34:57 +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 ADB9B61D65; Thu, 5 Nov 2015 15:34:52 +0000 (UTC) Received: from mail-lf0-f52.google.com (mail-lf0-f52.google.com [209.85.215.52]) by lists.linaro.org (Postfix) with ESMTPS id 9C3DC61970 for ; Thu, 5 Nov 2015 15:34:09 +0000 (UTC) Received: by lfs39 with SMTP id 39so29355358lfs.3 for ; Thu, 05 Nov 2015 07:34:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro_org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=WbsVHfG9u29aGhpZdo04DY4yqd2vPZt7qiMQganSzeg=; b=Jl1eipdvwN3p25UHRC57/hGjyr47tQMAcOobF/1wMADqItc23//QzQVGIcq7NyN1vF W3dRIoN5nML3YketEblQ0eAMpH49UQ0X3i0KMTo8KkPW1Y4wrO8EitVdyOmDVxfp5R25 +Ojg4K3AUKSaxXPBtuWYZHcWUFzljI+b11lLtL/yeG4Nivc+sEjYvT2Cf+WsG4wZRuxz 6twcY+c2K7XhGggCeqH5Ofwj3QtrraJ8sIgw6ZCBCD/i0S5cI8W9bXvjXaAn+YYIBgxW Kf5yJcbBynfnMnznWpvhzK4+5NhkK+F3hHhBXdYEB9k+9pmHsvjDBzALuYdnH0uviiMb mxFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=WbsVHfG9u29aGhpZdo04DY4yqd2vPZt7qiMQganSzeg=; b=ZDaZYw9sxUI9sHV4IgZYyD3O71B1wzZzQytPMj9aY0lDORPdE0rcQWZYIVriOgh0dT XVJTxd/umRVH5xbc0aZwthzcEaR9YOxm4b/tXWr2nVqfP635b9CPuJVnZgR7royPmcD/ 9dbE936Es4lyB2Hco00HUA8Bnd3Es5hzi2WsQrAIsEiqsdbJOgcrIp9kWJNiLeSjQ4tq 0CaGGQFYeJJZwZQ62dkddkJMbHTXrTKYqGcSbl+XkJYjmlxW6fvjfTCedWbrkD2sbgaR 0sYxmhnilCi9Jqz92UgNVn4RIWfStHH0qKZ6SvWq/+pbuo52HGl2dyK4/4wjYDIZavWY cL4Q== X-Gm-Message-State: ALoCoQmKQ/YoDzJRaxgtLN8g1JMOIRzmfvN1CnUI87rYzFCOOxBvMAC7tPndWAysaSuUoFEsk3WG X-Received: by 10.25.159.193 with SMTP id i184mr2286265lfe.63.1446737648484; Thu, 05 Nov 2015 07:34:08 -0800 (PST) Received: from localhost.localdomain ([195.238.92.128]) by smtp.gmail.com with ESMTPSA id oi5sm1034061lbb.13.2015.11.05.07.34.07 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 05 Nov 2015 07:34:07 -0800 (PST) From: Ivan Khoronzhuk To: lng-odp@lists.linaro.org Date: Thu, 5 Nov 2015 17:33:49 +0200 Message-Id: <1446737630-2323-6-git-send-email-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1446737630-2323-1-git-send-email-ivan.khoronzhuk@linaro.org> References: <1446737630-2323-1-git-send-email-ivan.khoronzhuk@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCH v7 5/6] test/example: avoid "cycle" word usage X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" 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" 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 --- test/performance/odp_pktio_perf.c | 35 ++++++++++++++--------------- test/validation/scheduler/scheduler.c | 6 ++--- test/validation/time/time.c | 42 +++++++++++++++++------------------ test/validation/time/time.h | 6 ++--- 4 files changed, 44 insertions(+), 45 deletions(-) diff --git a/test/performance/odp_pktio_perf.c b/test/performance/odp_pktio_perf.c index 2d64b40..2358951 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 { @@ -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,37 +328,36 @@ 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_local_from_ns( + burst_gap = odp_time_local_from_ns( ODP_TIME_SEC_IN_NS / (targs->pps / targs->batch_len)); send_duration = odp_time_local_from_ns(targs->duration * ODP_TIME_SEC_IN_NS); odp_barrier_wait(&globals->tx_barrier); - cur_cycles = odp_time_local(); - 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_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) { unsigned alloc_cnt = 0, tx_cnt; - if (odp_time_diff(burst_start_cycles, cur_cycles) - < burst_gap_cycles) { - cur_cycles = odp_time_local(); + if (odp_time_diff(burst_start_time, cur_time) < burst_gap) { + cur_time = odp_time_local(); if (!odp_time_cmp(idle_start, ODP_TIME_NULL)) - idle_start = cur_cycles; + idle_start = cur_time; continue; } if (odp_time_cmp(idle_start, ODP_TIME_NULL)) { - 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) @@ -369,14 +368,14 @@ static void *run_thread_tx(void *arg) stats->s.enq_failures += unsent_pkts; stats->s.tx_cnt += tx_cnt; - cur_cycles = odp_time_local(); + cur_time = odp_time_local(); } 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) / + odp_time_to_ns(stats->s.idle_ticks) / (uint64_t)ODP_TIME_MSEC_IN_NS); return NULL; diff --git a/test/validation/scheduler/scheduler.c b/test/validation/scheduler/scheduler.c index e813f82..52eb415 100644 --- a/test/validation/scheduler/scheduler.c +++ b/test/validation/scheduler/scheduler.c @@ -514,11 +514,11 @@ 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 time = 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_local()); + time = odp_time_sum(time, + odp_time_local()); odp_spinlock_unlock(&globals->atomic_lock); } diff --git a/test/validation/time/time.c b/test/validation/time/time.c index 231f50e..c8f02c0 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_local(); + t1 = odp_time_local(); while (count < BUSY_LOOP_CNT) { count++; }; - cycles2 = odp_time_local(); - CU_ASSERT((odp_time_cmp(cycles2, cycles1) > 0)); + t2 = odp_time_local(); + CU_ASSERT(odp_time_cmp(t2, t1) > 0); - diff = odp_time_diff(cycles1, cycles2); + diff = odp_time_diff(t1, t2); CU_ASSERT(odp_time_cmp(diff, ODP_TIME_NULL) > 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(diff, ODP_TIME_NULL) > 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_local_from_ns(ns1); - CU_ASSERT(odp_time_cmp(cycles, ODP_TIME_NULL) > 0); + time = odp_time_local_from_ns(ns1); + CU_ASSERT(odp_time_cmp(time, ODP_TIME_NULL) > 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) } odp_testinfo_t time_suite_time[] = { - ODP_TEST_INFO(time_test_odp_cycles_diff), - ODP_TEST_INFO(time_test_odp_cycles_negative_diff), - ODP_TEST_INFO(time_test_odp_time_conversion), + ODP_TEST_INFO(time_test_odp_diff), + ODP_TEST_INFO(time_test_odp_negative_diff), + ODP_TEST_INFO(time_test_odp_conversion), ODP_TEST_INFO_NULL }; diff --git a/test/validation/time/time.h b/test/validation/time/time.h index 9ccdeb7..b4e613c 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 odp_testinfo_t time_suite_time[];