From patchwork Thu Oct 15 13:02:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 55003 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by patches.linaro.org (Postfix) with ESMTPS id 014492301F for ; Thu, 15 Oct 2015 13:08:26 +0000 (UTC) Received: by lbbyh1 with SMTP id yh1sf4296608lbb.0 for ; Thu, 15 Oct 2015 06:08:24 -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=LOR5BGibr/59WiPka2FBBtXOm/eGNQJgew9TnWvDlmg=; b=RwBX9GxvvmwdtkPh/hBrSpmOjWqHb9ktpfYsAzL65fhiVsGdv80iI9H/zwFchSKQzp UP18QRE7XcvPyA9Oz4FTRMutZMQJ8TMGelKNOliZliPiijHFY0Nejcfmyw62RONPElTL hPgpUQ1eeVdxbyIWDQA5g5z91knxd/AP4WS1248oNJdB4XDXhKwCijXNU41vFn/t3nbI Ra0148ldfLwec9O55ncdQXkPh4dDuC4tRntqY470Trpi+2b41zdKNRXoXq/0D1x1WLVa uqEU55ELbhxpx1Jyzpi14AvLNOxFO7su+6Cz5njolkWC5kou9/6joqDRDPgHRwGuoCgh WZ0g== X-Gm-Message-State: ALoCoQmWy/CpV4MGfvIF4WmmL5Rd3Woh+dyhPCetwVmbUSsV3sMzOz0yoAQk8g9DsBMrkyfWYFt0 X-Received: by 10.180.10.202 with SMTP id k10mr6914070wib.2.1444914504965; Thu, 15 Oct 2015 06:08:24 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.157.135 with SMTP id g129ls144048lfe.84.gmail; Thu, 15 Oct 2015 06:08:24 -0700 (PDT) X-Received: by 10.25.79.84 with SMTP id d81mr2959074lfb.40.1444914504808; Thu, 15 Oct 2015 06:08:24 -0700 (PDT) Received: from mail-lf0-f45.google.com (mail-lf0-f45.google.com. [209.85.215.45]) by mx.google.com with ESMTPS id p76si9091951lfp.100.2015.10.15.06.08.23 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Oct 2015 06:08:23 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) client-ip=209.85.215.45; Received: by lfaz124 with SMTP id z124so27240387lfa.1 for ; Thu, 15 Oct 2015 06:08:23 -0700 (PDT) X-Received: by 10.25.86.213 with SMTP id k204mr2933657lfb.36.1444914503328; Thu, 15 Oct 2015 06:08:23 -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 w3csp623382lbq; Thu, 15 Oct 2015 06:08:22 -0700 (PDT) X-Received: by 10.140.92.143 with SMTP id b15mr11715948qge.85.1444914502347; Thu, 15 Oct 2015 06:08:22 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id j127si12745266qhc.30.2015.10.15.06.08.21; Thu, 15 Oct 2015 06:08:22 -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 A9D7761B23; Thu, 15 Oct 2015 13:08:21 +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 8A36961FE1; Thu, 15 Oct 2015 13:03:47 +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 3BCF261FF0; Thu, 15 Oct 2015 13:03:40 +0000 (UTC) Received: from mail-wi0-f175.google.com (mail-wi0-f175.google.com [209.85.212.175]) by lists.linaro.org (Postfix) with ESMTPS id 9161B61FD8 for ; Thu, 15 Oct 2015 13:02:39 +0000 (UTC) Received: by wicll6 with SMTP id ll6so39830112wic.0 for ; Thu, 15 Oct 2015 06:02:38 -0700 (PDT) X-Received: by 10.194.80.42 with SMTP id o10mr10284629wjx.31.1444914158559; Thu, 15 Oct 2015 06:02:38 -0700 (PDT) Received: from localhost.localdomain ([195.238.92.128]) by smtp.gmail.com with ESMTPSA id z4sm11886602wjz.29.2015.10.15.06.02.37 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 15 Oct 2015 06:02:37 -0700 (PDT) From: Ivan Khoronzhuk To: lng-odp@lists.linaro.org, petri.savolainen@nokia.com Date: Thu, 15 Oct 2015 16:02:22 +0300 Message-Id: <1444914142-20587-6-git-send-email-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1444914142-20587-1-git-send-email-ivan.khoronzhuk@linaro.org> References: <1444914142-20587-1-git-send-email-ivan.khoronzhuk@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCH v4 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.45 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 6e001a3..e78616c 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[];