From patchwork Tue Jan 2 19:00:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 123207 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp9307276qgn; Tue, 2 Jan 2018 11:10:43 -0800 (PST) X-Google-Smtp-Source: ACJfBouaazSvm36oGyUK4QW7ZLTZ2/0OkXXZb9bgS1d6OETZeqUFlYhpcO3Oeh9yvDmbQcVH1xZi X-Received: by 10.237.35.37 with SMTP id h34mr64558754qtc.9.1514920243812; Tue, 02 Jan 2018 11:10:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514920243; cv=none; d=google.com; s=arc-20160816; b=aNQK1+AywztX8aHzHgDjLo1bfLqfbcXMwAT+/CtAPTehJ1bG+C4QvZzu3QPMvsqvC5 SJcNkawBy84PO58BO+obbeijjGOz4hNliwBAph0PiVdNEbS5kI3G1U4tuSSOrXNz5pCA TxDfOCucN/tK/FXT5CXeQQtItKwMF7k5eHDAa+5jZrxjRYKM6KZhEe2TRYNbKD8H1+f4 rynCh+Ar6AoCiUIw4ZlVUjLeDrHlGr+bKhu1rQzkrklckqgklJkhQmGAbZWQUYHPTlAY WXtqeS0yCgKb3cR0YuUl801m2pKOXsvhRVXf4/ypK2zLbBsdCGRRo5c/Mh6LmuFf0ODH OMJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=5BpnUOLxwjo+du1z0v2BTWUsjwuebe/fRKCB3X8Ir34=; b=Gz0md4sTq+633qG/+l7kPlUAc/d/jGBJcpEhz0ftgMBHGS/8/cF5wvygH3RoKyWsXu vUVFRAACu/TqOwCRcmGVMn9hoTISm84b4UR6Q12dhjmO4HYLensTkT1RU3+NZY9C069w LRk4SFfYoENIQVrmiSeStCDlto0WrKdMbKbAiPQlKWa3uIdIb4FGuFuvhw6Az6yQ/S2W UsfyDUQB3o3YQh+SekAHq2tSLP0JUJGmPxqJjCn4RRODOpR+fGZxGvjTUqn7yb3k0rv3 2aMcwpiFa9uC9sAxSQk4/pTKyRGhdL17kiiX5A7vJYLttC6TzRYHB78+Sg7hjg7iyGzJ L56A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id l73si3807229qkh.130.2018.01.02.11.10.43; Tue, 02 Jan 2018 11:10:43 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 3ED7E6172A; Tue, 2 Jan 2018 19:10:43 +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,FREEMAIL_FROM, 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 DC47860A4A; Tue, 2 Jan 2018 19:03:00 +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 CF7AE60912; Tue, 2 Jan 2018 19:02:45 +0000 (UTC) Received: from forward106o.mail.yandex.net (forward106o.mail.yandex.net [37.140.190.187]) by lists.linaro.org (Postfix) with ESMTPS id 1944860912 for ; Tue, 2 Jan 2018 19:00:54 +0000 (UTC) Received: from mxback3o.mail.yandex.net (mxback3o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::1d]) by forward106o.mail.yandex.net (Yandex) with ESMTP id D47AC782D17 for ; Tue, 2 Jan 2018 22:00:52 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback3o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id UH8HRubBSf-0qxuDAf3; Tue, 02 Jan 2018 22:00:52 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id VfOU5TsWNg-0qNuAlcL; Tue, 02 Jan 2018 22:00:52 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Tue, 2 Jan 2018 22:00:16 +0300 Message-Id: <1514919619-15466-12-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514919619-15466-1-git-send-email-odpbot@yandex.ru> References: <1514919619-15466-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 377 Subject: [lng-odp] [PATCH v6 11/14] validation: time: use time() instead of clock() 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: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Dmitry Eremin-Solenikov ODP test for time API uses clock() to compare time against. However clock() returns processor time used by program, which can differ between runs. Use time() as a time source to compare against. Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 377 (lumag:misc-fixes) ** https://github.com/Linaro/odp/pull/377 ** Patch: https://github.com/Linaro/odp/pull/377.patch ** Base sha: 49ebafae0edebbc750742d8874ad0a7588286dea ** Merge commit sha: ef18568eed1d993a510166c16e978a3d9014ac83 **/ test/validation/api/time/time.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/validation/api/time/time.c b/test/validation/api/time/time.c index c8f90dbac..95422b683 100644 --- a/test/validation/api/time/time.c +++ b/test/validation/api/time/time.c @@ -423,11 +423,11 @@ static void time_test_accuracy(time_cb time_cur, time_from_ns_cb time_from_ns) { int i; odp_time_t t1, t2, wait, diff; - clock_t c1, c2; + time_t c1, c2; double sec_t, sec_c; odp_time_t sec = time_from_ns(ODP_TIME_SEC_IN_NS); - c1 = clock(); + c1 = time(NULL); t1 = time_cur(); wait = odp_time_sum(t1, sec); @@ -436,12 +436,12 @@ static void time_test_accuracy(time_cb time_cur, time_from_ns_cb time_from_ns) wait = odp_time_sum(wait, sec); } + c2 = time(NULL); t2 = time_cur(); - c2 = clock(); diff = odp_time_diff(t2, t1); sec_t = ((double)odp_time_to_ns(diff)) / ODP_TIME_SEC_IN_NS; - sec_c = ((double)(c2 - c1)) / CLOCKS_PER_SEC; + sec_c = ((double)(c2 - c1)); /* Check that ODP time is within +-5% of system time */ CU_ASSERT(sec_t < sec_c * 1.05);