From patchwork Thu Oct 22 12:01:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 55438 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lf0-f69.google.com (mail-lf0-f69.google.com [209.85.215.69]) by patches.linaro.org (Postfix) with ESMTPS id 2A41822AA5 for ; Thu, 22 Oct 2015 12:06:18 +0000 (UTC) Received: by lfu67 with SMTP id 67sf5517159lfu.2 for ; Thu, 22 Oct 2015 05:06:17 -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=lI96s8Slg7q1Ez3l/jYbgH9uwdJyFhG4siR5V79n+ao=; b=UysnyuZbHINrx2/RS7frgIBWigcSgDE45oJdM0GJUVdQ91ArB5tK1lQFFX5M/WCaJ2 JPsN6Rgefy+xhnCd8DF5ALW3uDlz6XrDjaLL3osueJfaKrM31f54LOKWT4OzQWjRny5h 51AsoOOuBMFi9zYw00Zopc3Xv0cbUVBRUrqCP+6OtW4SclX+sSQ6ndJv4OCIOKUiwChD whQ8E5KTNo04zleKgsuwj0Ji6InJPlP+aHKzy/A4/MobBQwrmae5XEezYbN5R1keTAkD mLYpE9Nn5PQhOCwy1GpSxksw8J4LE63oP65iYo3I3oA1w5Pc23A0exjfQkqNWgxEe7P1 yUrg== X-Gm-Message-State: ALoCoQnGCjLhYKSiyqPg3oKLmiXvc5qEzGdLYfdXkgWYoBMkgCguDY+0Pp5aqywOrGAbt3DrV9SA X-Received: by 10.194.156.193 with SMTP id wg1mr3597937wjb.3.1445515577087; Thu, 22 Oct 2015 05:06:17 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.86.9 with SMTP id k9ls19805lfb.43.gmail; Thu, 22 Oct 2015 05:06:16 -0700 (PDT) X-Received: by 10.25.26.71 with SMTP id a68mr5495807lfa.109.1445515576931; Thu, 22 Oct 2015 05:06:16 -0700 (PDT) Received: from mail-lf0-f51.google.com (mail-lf0-f51.google.com. [209.85.215.51]) by mx.google.com with ESMTPS id p74si9416175lfd.22.2015.10.22.05.06.16 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Oct 2015 05:06:16 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) client-ip=209.85.215.51; Received: by lfaz124 with SMTP id z124so45113337lfa.1 for ; Thu, 22 Oct 2015 05:06:16 -0700 (PDT) X-Received: by 10.25.150.199 with SMTP id y190mr5479507lfd.35.1445515576801; Thu, 22 Oct 2015 05:06:16 -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.59.35 with SMTP id w3csp561610lbq; Thu, 22 Oct 2015 05:06:15 -0700 (PDT) X-Received: by 10.140.218.133 with SMTP id o127mr19131286qhb.4.1445515575564; Thu, 22 Oct 2015 05:06:15 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id e13si12959730qhc.3.2015.10.22.05.06.15; Thu, 22 Oct 2015 05:06:15 -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 33FF26203A; Thu, 22 Oct 2015 12:06:15 +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 6ACCB6204A; Thu, 22 Oct 2015 12:02:31 +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 95BA361D23; Thu, 22 Oct 2015 12:02:18 +0000 (UTC) Received: from mail-lf0-f44.google.com (mail-lf0-f44.google.com [209.85.215.44]) by lists.linaro.org (Postfix) with ESMTPS id 16B5D61D1B for ; Thu, 22 Oct 2015 12:01:54 +0000 (UTC) Received: by lfbn126 with SMTP id n126so10732899lfb.2 for ; Thu, 22 Oct 2015 05:01:53 -0700 (PDT) X-Received: by 10.25.41.134 with SMTP id p128mr4281857lfp.75.1445515313065; Thu, 22 Oct 2015 05:01:53 -0700 (PDT) Received: from khorivan.synapse.com ([212.90.60.8]) by smtp.gmail.com with ESMTPSA id bn5sm2296353lbc.16.2015.10.22.05.01.51 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 22 Oct 2015 05:01:52 -0700 (PDT) From: Ivan Khoronzhuk To: lng-odp@lists.linaro.org, petri.savolainen@nokia.com Date: Thu, 22 Oct 2015 15:01:39 +0300 Message-Id: <1445515299-18496-6-git-send-email-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1445515299-18496-1-git-send-email-ivan.khoronzhuk@linaro.org> References: <1445515299-18496-1-git-send-email-ivan.khoronzhuk@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCH v5 5/5] 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.51 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 --- 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(-) diff --git a/test/performance/odp_pktio_perf.c b/test/performance/odp_pktio_perf.c index cf29802..5e52ae2 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,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; } diff --git a/test/validation/scheduler/scheduler.c b/test/validation/scheduler/scheduler.c index 96e0781..8d8a0a5 100644 --- a/test/validation/scheduler/scheduler.c +++ b/test/validation/scheduler/scheduler.c @@ -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); } diff --git a/test/validation/time/time.c b/test/validation/time/time.c index a81d7ff..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[];