From patchwork Thu May 19 16:27:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 68161 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp3279967qge; Thu, 19 May 2016 08:52:46 -0700 (PDT) X-Received: by 10.140.219.200 with SMTP id p191mr15173188qhb.90.1463673166337; Thu, 19 May 2016 08:52:46 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id b67si13147779qke.206.2016.05.19.08.52.46; Thu, 19 May 2016 08:52:46 -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; 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; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 0175A617F7; Thu, 19 May 2016 15:52:45 +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 360F2618DC; Thu, 19 May 2016 15:32:51 +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 4F4006181E; Thu, 19 May 2016 15:32:40 +0000 (UTC) Received: from mail-lf0-f50.google.com (mail-lf0-f50.google.com [209.85.215.50]) by lists.linaro.org (Postfix) with ESMTPS id 6197D6181B for ; Thu, 19 May 2016 15:29:00 +0000 (UTC) Received: by mail-lf0-f50.google.com with SMTP id e130so3873634lfe.3 for ; Thu, 19 May 2016 08:29:00 -0700 (PDT) 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=JXCS74eb/aOJ81zxcs7fRn+CoNANRFl8hbR1GBSDnTQ=; b=Cpmjt22XF3x4mZyS1AOHj6jtp5f8RlWWP2T3yHuWocKVmHgiTkqQQfjGzeShNxjjUP K8TxpEmVOuYBr4n68HOAG7oYDZNy2zJpAJ/i1RCPiPrWHyh0x6G3V4NZPSpdg8JJbg0u 28Jp4oz9eXeYh0WSK2ps2Th+HpGUNG+b0SvQzMiq8vVxGr1u+64myB3fkX5ImmplzGj/ XFKuG2C+tl0ju5PdnngP0MeGeBiwD2twMfy7itpM68fu7xynFuQ0vBk/r6FcXJpy4vLN lKDihkz7ZylT83eKTZ08IbrnBTtkBT1Y0Yklmk7zhXwBiXmYy7nUWJp7P1PvD22ELcaf skAA== X-Gm-Message-State: AOPr4FUBG8PolhqLquLNWlqL5/9j1FKYRC30632FMgj5z/tuAt/yWtHKFoHkbvdYNXxsW4OJiac= X-Received: by 10.25.142.141 with SMTP id q135mr5183981lfd.11.1463671739220; Thu, 19 May 2016 08:28:59 -0700 (PDT) Received: from erachmi-ericsson.ki.sw.ericsson.se (c-83-233-90-46.cust.bredband2.com. [83.233.90.46]) by smtp.gmail.com with ESMTPSA id cv11sm2366290lbb.49.2016.05.19.08.28.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 19 May 2016 08:28:58 -0700 (PDT) From: Christophe Milard To: brian.brooks@linaro.org, maxim.uvarov@linaro.com, lng-odp@lists.linaro.org Date: Thu, 19 May 2016 18:27:09 +0200 Message-Id: <1463675234-6739-31-git-send-email-christophe.milard@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1463675234-6739-1-git-send-email-christophe.milard@linaro.org> References: <1463675234-6739-1-git-send-email-christophe.milard@linaro.org> X-Topics: timers patch Subject: [lng-odp] [PATCHv8 30/35] example: timer: adding helper cmd line parsing 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" timer_test now calls the helper command line parsing so that helper can collect its options. Hence enabling process mode run. Signed-off-by: Christophe Milard --- example/timer/odp_timer_test.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c index 2a33085..cb58dfe 100644 --- a/example/timer/odp_timer_test.c +++ b/example/timer/odp_timer_test.c @@ -259,7 +259,7 @@ static void parse_args(int argc, char *argv[], test_args_t *args) int opt; int long_index; - static struct option longopts[] = { + static const struct option longopts[] = { {"count", required_argument, NULL, 'c'}, {"resolution", required_argument, NULL, 'r'}, {"min", required_argument, NULL, 'm'}, @@ -270,6 +270,11 @@ static void parse_args(int argc, char *argv[], test_args_t *args) {NULL, 0, NULL, 0} }; + static const char *shortopts = "+c:r:m:x:p:t:h"; + + /* let helper collect its own arguments (e.g. --odph_proc) */ + odph_parse_options(argc, argv, shortopts, longopts); + /* defaults */ args->cpu_count = 0; /* all CPU's */ args->resolution_us = 10000; @@ -278,9 +283,10 @@ static void parse_args(int argc, char *argv[], test_args_t *args) args->period_us = 1000000; args->tmo_count = 30; + opterr = 0; /* do not issue errors on helper options */ + while (1) { - opt = getopt_long(argc, argv, "+c:r:m:x:p:t:h", - longopts, &long_index); + opt = getopt_long(argc, argv, shortopts, longopts, &long_index); if (opt == -1) break; /* No more options */