From patchwork Thu Sep 4 09:55:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petri Savolainen X-Patchwork-Id: 36685 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f71.google.com (mail-yh0-f71.google.com [209.85.213.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1733D20523 for ; Thu, 4 Sep 2014 09:54:35 +0000 (UTC) Received: by mail-yh0-f71.google.com with SMTP id 29sf34280797yhl.2 for ; Thu, 04 Sep 2014 02:54:34 -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: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:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list :content-type:content-transfer-encoding; bh=OU6KvOL0ywkLLFOxbZs8iCWW5KsxBwBXjTCqrzdMeeM=; b=ikCMZKQk3nlKUMntCLzh2GwQu0iV0uXNEAIQE/7AhzwHaf4x4hFLbnEVye2O6aKhck agZI9WFUhcWq89LXFSmZnos/Sx2Dk3pKAozlgMUz+tSeyouWpl9eDsmmKWSSsF6FGBeh IUrzUM/AxPVMqFpD43HpH1jl+AUS3gZ8hj1UCfNaNjvx2c69o6St6Wfj1dYS08FFm5d3 oC7zL0+9ppU6tbLpT8L30BwZ9Wv1aqd2qoV3oK877RnbGXLNni0mjZJEpqtsHmCRey/1 HIArlneg3gRbmcCfLWa9QYDWDEa1k1ksHI1yGUlkA0S7W7Z58cRm/nWc+8PLtW0cNwhh hH1g== X-Gm-Message-State: ALoCoQlrLikNt2CeN68edfjh3tnTinE57Se9Zr9C98S2WHmSVeP3J15wqNSApCQl+O4nzPA9cHLw X-Received: by 10.52.30.104 with SMTP id r8mr1880794vdh.7.1409824474676; Thu, 04 Sep 2014 02:54:34 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.104.130 with SMTP id a2ls191527qgf.90.gmail; Thu, 04 Sep 2014 02:54:34 -0700 (PDT) X-Received: by 10.52.185.193 with SMTP id fe1mr2116341vdc.31.1409824474593; Thu, 04 Sep 2014 02:54:34 -0700 (PDT) Received: from mail-vc0-f179.google.com (mail-vc0-f179.google.com [209.85.220.179]) by mx.google.com with ESMTPS id wu1si2570641vdb.101.2014.09.04.02.54.34 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 04 Sep 2014 02:54:34 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.179 as permitted sender) client-ip=209.85.220.179; Received: by mail-vc0-f179.google.com with SMTP id hy4so10112299vcb.24 for ; Thu, 04 Sep 2014 02:54:34 -0700 (PDT) X-Received: by 10.52.243.10 with SMTP id wu10mr315660vdc.45.1409824474503; Thu, 04 Sep 2014 02:54:34 -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.221.45.67 with SMTP id uj3csp807904vcb; Thu, 4 Sep 2014 02:54:34 -0700 (PDT) X-Received: by 10.140.47.129 with SMTP id m1mr4716834qga.95.1409824473536; Thu, 04 Sep 2014 02:54:33 -0700 (PDT) Received: from ip-10-141-164-156.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id 3si13910015qcp.4.2014.09.04.02.54.32 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 04 Sep 2014 02:54:33 -0700 (PDT) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-141-164-156.ec2.internal) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XPTkO-0006F6-Jv; Thu, 04 Sep 2014 09:54:32 +0000 Received: from mail-qc0-f176.google.com ([209.85.216.176]) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XPTkH-0006DQ-9j for lng-odp@lists.linaro.org; Thu, 04 Sep 2014 09:54:25 +0000 Received: by mail-qc0-f176.google.com with SMTP id m20so10328103qcx.35 for ; Thu, 04 Sep 2014 02:54:20 -0700 (PDT) X-Received: by 10.140.96.180 with SMTP id k49mr5056009qge.78.1409824460031; Thu, 04 Sep 2014 02:54:20 -0700 (PDT) Received: from localhost.localdomain (ec2-23-23-178-99.compute-1.amazonaws.com. [23.23.178.99]) by mx.google.com with ESMTPSA id o6sm18938555qag.40.2014.09.04.02.54.17 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 04 Sep 2014 02:54:18 -0700 (PDT) From: Petri Savolainen To: lng-odp@lists.linaro.org Date: Thu, 4 Sep 2014 12:55:11 +0300 Message-Id: <1409824511-11368-2-git-send-email-petri.savolainen@linaro.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1409824511-11368-1-git-send-email-petri.savolainen@linaro.org> References: <1409824511-11368-1-git-send-email-petri.savolainen@linaro.org> X-Topics: timers patch Subject: [lng-odp] [PATCH v4 2/2] Timer example error check X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 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-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: petri.savolainen@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.220.179 as permitted sender) smtp.mail=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 Signed-off-by: Petri Savolainen --- example/timer/odp_timer_test.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c index 4168856..1061190 100644 --- a/example/timer/odp_timer_test.c +++ b/example/timer/odp_timer_test.c @@ -26,10 +26,6 @@ #define MAX_WORKERS 32 /**< Max worker threads */ #define MSG_POOL_SIZE (4*1024*1024) /**< Message pool size */ -/* Nanoseconds */ -#define USEC 1000UL -#define MSEC 1000000UL -#define SEC 1000000000UL /** Test arguments */ typedef struct { @@ -63,7 +59,7 @@ static void test_abs_timeouts(int thr, test_args_t *args) queue = odp_queue_lookup("timer_queue"); - period_ns = args->period_us*USEC; + period_ns = args->period_us*ODP_TIME_USEC; period = odp_timer_ns_to_tick(test_timer, period_ns); ODP_DBG(" [%i] period %"PRIu64" ticks, %"PRIu64" ns\n", thr, @@ -195,7 +191,7 @@ static void parse_args(int argc, char *argv[], test_args_t *args) args->core_count = 0; /* all cores */ args->resolution_us = 10000; args->min_us = args->resolution_us; - args->max_us = 100000000; + args->max_us = 10000000; args->period_us = 1000000; args->tmo_count = 30; @@ -343,9 +339,15 @@ int main(int argc, char *argv[]) } test_timer = odp_timer_create("test_timer", pool, - args.resolution_us*USEC, - args.min_us*USEC, - args.max_us*USEC); + args.resolution_us*ODP_TIME_USEC, + args.min_us*ODP_TIME_USEC, + args.max_us*ODP_TIME_USEC); + + if (test_timer == ODP_TIMER_INVALID) { + ODP_ERR("Timer create failed.\n"); + return -1; + } + odp_shm_print_all(); @@ -358,7 +360,7 @@ int main(int argc, char *argv[]) printf(" %12"PRIu64" cycles -> %12"PRIu64" ns\n", cycles, odp_time_cycles_to_ns(cycles)); - for (ns = 1; ns <= 100*SEC; ns *= 10) { + 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,