From patchwork Tue Nov 10 15:35:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 56337 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp841365lbb; Tue, 10 Nov 2015 07:39:29 -0800 (PST) X-Received: by 10.140.150.139 with SMTP id 133mr5478525qhw.58.1447169969445; Tue, 10 Nov 2015 07:39:29 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id p105si3374813qgp.3.2015.11.10.07.39.29; Tue, 10 Nov 2015 07:39:29 -0800 (PST) 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; dkim=neutral (body hash did not verify) header.i=@linaro_org.20150623.gappssmtp.com Received: by lists.linaro.org (Postfix, from userid 109) id F380561960; Tue, 10 Nov 2015 15:39:28 +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.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID, 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 5669761D19; Tue, 10 Nov 2015 15:37:58 +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 D8A9361D19; Tue, 10 Nov 2015 15:37:53 +0000 (UTC) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com [209.85.217.169]) by lists.linaro.org (Postfix) with ESMTPS id 2DEDB6198C for ; Tue, 10 Nov 2015 15:36:11 +0000 (UTC) Received: by lbbcs9 with SMTP id cs9so170331lbb.1 for ; Tue, 10 Nov 2015 07:36:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro_org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=OVFNnKjpQ4gvtlNqHXMXUaIb+7w9zsuzDrzJeYkX9mg=; b=v92OL3lGjzX5GmBRQuPSu0A7ZhX8703zA3DXjLAMIxo1VB1ssp4QdPTNSkOYtmKbOA KC+0XuHp18gb1wbxAGsm0K2tPf8I6HMSB1JoSlpZfXS8pXwpgQyrYnYLD+TpG5JHc0F2 s+cFEMb5yk3hQXAQGH6j5Nr9wKiW+Tg2ApBHAtC6nbjWSRXYLda5SYpq4FgKNFpzOPdx 5AUlwHHoCY7Qr+N7NLCSbLnNVsbQqOH9foxwJ9YNM7LcVerFxP0qXiMeOTrxfGbmxTrQ U29fObqpxi60eeEoEbFzod0sNf+NWcnHny5MpocoMG6EehooFIvgSWQ9alnkRunq6TsL iqrA== 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=OVFNnKjpQ4gvtlNqHXMXUaIb+7w9zsuzDrzJeYkX9mg=; b=d5RP7irBpeg499BCB8nnmEej5m/lYnaBqdy0jeIxFbvaWCI3UAJtMKcanW3zFr3v5/ LxrkjEvwnBKOeF43UZfCLIvQourwd91iq6RzV3cVwLtxnSu9Teah2RfizdFUIuQONTEs I6SNCePsc9F926OEeeOTlrCy4jvf1cmBmUC0G6ed1l1Obu9Zo20YDTVDVZdSCNVfvR+O yS1hcHyoeSNvuZ9TClgiMy0GuXVDPPP6aS3IngZvuxRNdU2NC8mOrsqY6rlMLHTDs/px C+IcgMUmyv1WwgdlwlOmQjaGjzsNDBDCjOPyopevfSGlE8wr/9AofcILUZF9H7x0K5IH ZEAQ== X-Gm-Message-State: ALoCoQmc9ZAZuKlESVrGOnnlc5ryNkEZVdxIrZctBDopJRsoNBGAGaSXOHa50Nl6sF42nXS3ygsK X-Received: by 10.112.139.164 with SMTP id qz4mr1344467lbb.78.1447169770059; Tue, 10 Nov 2015 07:36:10 -0800 (PST) Received: from localhost.localdomain ([195.238.92.128]) by smtp.gmail.com with ESMTPSA id h37sm625049lfi.8.2015.11.10.07.36.09 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Nov 2015 07:36:09 -0800 (PST) From: Ivan Khoronzhuk To: lng-odp@lists.linaro.org Date: Tue, 10 Nov 2015 17:35:58 +0200 Message-Id: <1447169760-15258-2-git-send-email-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1447169760-15258-1-git-send-email-ivan.khoronzhuk@linaro.org> References: <1447169760-15258-1-git-send-email-ivan.khoronzhuk@linaro.org> X-Topics: timers patch Subject: [lng-odp] [PATCH 1/3 v3] example: timer: warn if timeout less than resolution 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" The period shouldn't be less than timer resolution. If it's less there is no guarantee about timeout accuracy, it can be executed right after setting it or after up to timer resolution timeout or even be set late, in which case application will be stopped with error. So it's better to warn user that timeout is less then resolution instead of silence. Signed-off-by: Ivan Khoronzhuk Reviewed-by: Ola Liljedahl --- example/timer/odp_timer_test.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c index 94619e4..aee01c8 100644 --- a/example/timer/odp_timer_test.c +++ b/example/timer/odp_timer_test.c @@ -311,6 +311,9 @@ static void parse_args(int argc, char *argv[], test_args_t *args) break; } } + + if (args->period_us < args->resolution_us) + printf("\n\tWarn: timeout is set less then resolution\n"); }