From patchwork Tue Nov 10 14:40:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 56326 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp809648lbb; Tue, 10 Nov 2015 06:42:15 -0800 (PST) X-Received: by 10.140.43.183 with SMTP id e52mr4695521qga.38.1447166535598; Tue, 10 Nov 2015 06:42:15 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id l9si3151157qhl.13.2015.11.10.06.42.15; Tue, 10 Nov 2015 06:42:15 -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 39F7061CEB; Tue, 10 Nov 2015 14:42:15 +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 8608961D13; Tue, 10 Nov 2015 14:40:45 +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 A594A61D10; Tue, 10 Nov 2015 14:40:42 +0000 (UTC) Received: from mail-lb0-f180.google.com (mail-lb0-f180.google.com [209.85.217.180]) by lists.linaro.org (Postfix) with ESMTPS id 9799661B7C for ; Tue, 10 Nov 2015 14:40:37 +0000 (UTC) Received: by lbbkw15 with SMTP id kw15so115231972lbb.0 for ; Tue, 10 Nov 2015 06:40:36 -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=HkU3rGLsjsPyb1YeOAzStFWZfE75niPfkFzoGqa9d9Y/jxbNaQbQVCnKkYV2Wt0gI6 AT00p1a93om+xTQDUHAtbIY7VHUssNNdlj3jnWObYuks/95LmQ+kvVoJ4MOAZfLjcCEz CtUVSx51KSj1x1kBaWBEQzu7wJEka9LxHUO4SmA8xwIb4WEStbwjC4tbPPsLtCLmpY2h sEVhdEh8DvFwaxFboFWq1ChgPBfwwB2A5ayh21PA2F1ayjOT+kPr29XolwPgRSi1SDZj v57YGCoZWesDYgEt03stKT2CKRwYWtNNLK3n+QXBaLYtGBOHiheGRRdMJDLqdlhIy+8B uocw== 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=NersgAP2c5V7cbevgG5h6+O6iv9HiXIjyIaeLagdgvvAXZcOztOy86+LjWfKgC2KSQ k4sDsOBG8vMUqXXBF8qZC5oOHLGmMdSfzt+PkDluFXyulNY3A+yCmhKAplNPhC9W1u4u wobJXn9Z0ME2I5T+eIjPp5FF5NQs2jL8gdKNEXGxPahlkKUu7yR5enRetTYcKD7QA48f MvFs9dKFx46rZxpNUlWrB8G1lefWLLaKdJcMcqGLiYRLQcrGcWIdu4sJkSXzxxtr/bC9 nWo93BjIXbJ6jDZc0ARyCqS+RvL0nz3qI4hi9nk1LwfyMxXpLnyFppbhFBv/hH/lQ2UV BMXg== X-Gm-Message-State: ALoCoQkQZworOO3gMUuC6L65opzU6uHgOE5k2+4DpR9zGCbxwW9YAZ4KNlQ+CywoDQfd36MOHL21 X-Received: by 10.112.150.168 with SMTP id uj8mr1927920lbb.22.1447166436308; Tue, 10 Nov 2015 06:40:36 -0800 (PST) Received: from localhost.localdomain ([195.238.92.128]) by smtp.gmail.com with ESMTPSA id tp5sm567643lbb.27.2015.11.10.06.40.35 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Nov 2015 06:40:35 -0800 (PST) From: Ivan Khoronzhuk To: lng-odp@lists.linaro.org Date: Tue, 10 Nov 2015 16:40:26 +0200 Message-Id: <1447166428-23791-2-git-send-email-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1447166428-23791-1-git-send-email-ivan.khoronzhuk@linaro.org> References: <1447166428-23791-1-git-send-email-ivan.khoronzhuk@linaro.org> X-Topics: timers patch Subject: [lng-odp] [PATCH 1/3 v2] 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 --- 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"); }