From patchwork Thu Sep 3 08:50: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: 53013 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 5E08122E3F for ; Thu, 3 Sep 2015 08:51:51 +0000 (UTC) Received: by laeb10 with SMTP id b10sf13810922lae.1 for ; Thu, 03 Sep 2015 01:51:50 -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: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=f8p6PMVUHDTmuT7aATPIZdqreSgRdcwWlVBM3OOJEBM=; b=nNGUNIMtX6jr7J2PZV9PXc6OhEvUnVc5h37NyNI7T1ozWXFu+98MXyVR+Xna8KfPXp w8o7oIZJli9ralQ1Zcmu1z6Xw4dUiHyFetE0n/rU4p+UmuV/NdHq055dql8ChzD5g0Ra CVE0vA2Qoo6PnfeSFprVOnPceOJHvGRhEKjYz5ydXJJ0Lg0oKZpIPeUR0+cXY/+MLqXy e1zpJ6N03GIN5Ozlp8G3/NxEVcoaCBLJ9PmUrCOTe/0ThpSw/NXxz4tfY3boVWEoqSIK xlLSW5DQCIB/i/DsPQp4YY/2FMNC/3ylfKP4ArtSuhLmLM5bwUm5klGQd73ArDloTrss tqBg== X-Gm-Message-State: ALoCoQkDV4ZbPTPajtqWA6SgCU7uo/hlBI+WOar+SudVK+iKnxPAhl4FTB7MV6RV7arY44WeIjwD X-Received: by 10.112.89.228 with SMTP id br4mr10302048lbb.3.1441270310331; Thu, 03 Sep 2015 01:51:50 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.170.232 with SMTP id ap8ls147802lac.18.gmail; Thu, 03 Sep 2015 01:51:50 -0700 (PDT) X-Received: by 10.112.234.197 with SMTP id ug5mr20353170lbc.79.1441270310175; Thu, 03 Sep 2015 01:51:50 -0700 (PDT) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com. [209.85.217.169]) by mx.google.com with ESMTPS id gm7si22465083lbc.173.2015.09.03.01.51.50 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Sep 2015 01:51:50 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) client-ip=209.85.217.169; Received: by lbpo4 with SMTP id o4so20327575lbp.2 for ; Thu, 03 Sep 2015 01:51:50 -0700 (PDT) X-Received: by 10.112.166.106 with SMTP id zf10mr20637176lbb.36.1441270310067; Thu, 03 Sep 2015 01:51:50 -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 yn10csp1113854lbb; Thu, 3 Sep 2015 01:51:49 -0700 (PDT) X-Received: by 10.140.99.117 with SMTP id p108mr4347041qge.91.1441270309185; Thu, 03 Sep 2015 01:51:49 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id n81si4973769qhb.62.2015.09.03.01.51.47; Thu, 03 Sep 2015 01:51:49 -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 C6DA861A0C; Thu, 3 Sep 2015 08:51:47 +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 937A7619F1; Thu, 3 Sep 2015 08:51:07 +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 E5F1661A28; Thu, 3 Sep 2015 08:51:01 +0000 (UTC) Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com [209.85.212.181]) by lists.linaro.org (Postfix) with ESMTPS id 4FF5F619E8 for ; Thu, 3 Sep 2015 08:51:00 +0000 (UTC) Received: by wicfx3 with SMTP id fx3so44038344wic.0 for ; Thu, 03 Sep 2015 01:50:59 -0700 (PDT) X-Received: by 10.194.173.35 with SMTP id bh3mr45960624wjc.88.1441270259224; Thu, 03 Sep 2015 01:50:59 -0700 (PDT) Received: from khorivan.synapse.com ([195.238.92.128]) by smtp.gmail.com with ESMTPSA id ej5sm36624329wjd.22.2015.09.03.01.50.57 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 03 Sep 2015 01:50:58 -0700 (PDT) From: Ivan Khoronzhuk To: lng-odp@lists.linaro.org Date: Thu, 3 Sep 2015 11:50:52 +0300 Message-Id: <1441270252-20977-1-git-send-email-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 1.9.1 X-Topics: timers patch Subject: [lng-odp] [RFC Patch] example: timer: move cycles/ns table to validation tests 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.169 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 linux-generic implements timers supposing that timers are based on CPU cycle counter. It's not always true and timer API can have nothing common with CPU cycles. Thus timer test shouldn't print here conversion cycles/ns table for time API. Signed-off-by: Ivan Khoronzhuk --- I'm not sure about moving the table to validation test, but it can be useful to visually see resolution impact. This patch should be included in "odp-lng] [Patch 0/4] preparation series before updating odp time API" https://lists.linaro.org/pipermail/lng-odp/2015-August/014850.html But before let's clarify it. example/timer/odp_timer_test.c | 21 --------------------- test/validation/time/time.c | 21 ++++++++++++++++++++- 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c index 49630b0..6248939 100644 --- a/example/timer/odp_timer_test.c +++ b/example/timer/odp_timer_test.c @@ -322,7 +322,6 @@ 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; odp_queue_param_t param; odp_pool_param_t params; odp_timer_pool_param_t tparams; @@ -446,26 +445,6 @@ int main(int argc, char *argv[]) return -1; } - printf("CPU freq %"PRIu64" Hz\n", odp_sys_cpu_hz()); - printf("Cycles vs nanoseconds:\n"); - ns = 0; - cycles = odp_time_ns_to_cycles(ns); - - printf(" %12"PRIu64" ns -> %12"PRIu64" cycles\n", ns, cycles); - printf(" %12"PRIu64" cycles -> %12"PRIu64" ns\n", cycles, - odp_time_cycles_to_ns(cycles)); - - for (ns = 1; ns <= 100*ODP_TIME_SEC; ns *= 10) { - cycles = odp_time_ns_to_cycles(ns); - - printf(" %12"PRIu64" ns -> %12"PRIu64" cycles\n", ns, - cycles); - printf(" %12"PRIu64" cycles -> %12"PRIu64" ns\n", cycles, - odp_time_cycles_to_ns(cycles)); - } - - printf("\n"); - gbls->num_workers = num_workers; /* Initialize number of timeouts to receive */ diff --git a/test/validation/time/time.c b/test/validation/time/time.c index 4b81c2c..ae5e77c 100644 --- a/test/validation/time/time.c +++ b/test/validation/time/time.c @@ -45,7 +45,7 @@ void time_test_odp_cycles_negative_diff(void) /* check that related conversions come back to the same value */ void time_test_odp_time_conversion(void) { - uint64_t ns1, ns2, cycles; + uint64_t ns, ns1, ns2, cycles; uint64_t upper_limit, lower_limit; ns1 = 100; @@ -59,6 +59,25 @@ void time_test_odp_time_conversion(void) upper_limit = ns1 + TOLERANCE; lower_limit = ns1 - TOLERANCE; CU_ASSERT((ns2 <= upper_limit) && (ns2 >= lower_limit)); + + printf("Cycles vs nanoseconds:\n"); + ns = 0; + cycles = odp_time_ns_to_cycles(ns); + + printf(" %12" PRIu64 " ns -> %12" PRIu64 " cycles\n", ns, cycles); + printf(" %12" PRIu64 " cycles -> %12" PRIu64 " ns\n", cycles, + odp_time_cycles_to_ns(cycles)); + + for (ns = 1; ns <= 100 * ODP_TIME_SEC; ns *= 10) { + cycles = odp_time_ns_to_cycles(ns); + + printf(" %12" PRIu64 " ns -> %12" PRIu64 " cycles\n", ns, + cycles); + printf(" %12" PRIu64 " cycles -> %12" PRIu64 " ns\n", cycles, + odp_time_cycles_to_ns(cycles)); + } + + printf("\n"); } CU_TestInfo time_suite_time[] = {