From patchwork Fri Nov 24 13:00:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 119579 Delivered-To: patch@linaro.org Received: by 10.80.225.132 with SMTP id k4csp2135241edl; Fri, 24 Nov 2017 05:02:08 -0800 (PST) X-Google-Smtp-Source: AGs4zMZTT+F7LQLYhuhhghe6xhMQNLAHhmfsqS4zRievDSQDp6Q12pzN/OCI0WE1glNbPiTajkM7 X-Received: by 10.55.178.68 with SMTP id b65mr16166484qkf.139.1511528528542; Fri, 24 Nov 2017 05:02:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511528528; cv=none; d=google.com; s=arc-20160816; b=MdvgCqo3KrGFfElKOJo2HPMOFGaEXIvmRgRoZtURo1Q6Jsey3oCU8XTQ3IZ6+ZnJsr xc5omttYvu5AVnx9wHeuKqZqutvd/jyNS6N6fvzlipHd471z3MS/aBoKYLvMOvZRUIxv mitBO2gERFCnkzsx1AndqhERc8/s+RPyh5v+Zr0ZPok3A5xNC/40P1RaR5w8FyvAm8XL pcJcRAuUA0wJZMpUB32ytwC/bdUFg9i0aq3WCYZNYyuAf6lmSZjVzpjHqXNNSQ0FhwjU XQUQ6De6TvYPP12ggB9NDidPS5xAdaNV8succYenwwavzYwjr1qFZwM9H8omhCgt60Ac gS6Q== 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=QmwTkmOB9IwB/aJ/b8OSDjtObmK/9BlmEJqn2t7O2ew=; b=sb4mFA/+yHNVjev14XPhpGmWyjZ5AbvnAHW+6MlgPDpbPBpqmCkqa6StTOGZ5rfjHl 2sO28YR1+PKMfmBn89I/MyZhxPhYZvaqnBXgS9kh+GNoROxRZJNWbDLgw0U1BOKQcB6y YnqBSrxXVoicGaqx6BHJmo1Er9MKcdBeq9Gs8jHCamM8hOmrG08B7ZElUwAl0RPqcxN6 hqz1VSFg6Fd7pILZ5skLpU8Sdj4HezRXdgik0IuWMnns71zecb57X1WDIvhQvdB1bW8D 0et08yTyP9267QVI5e0WSz5FMhiEiEOEprF0+MB/+TLW+F6oPMMiqVyRQVMJyOggyWxI goOg== 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 z26si486966qtg.436.2017.11.24.05.02.08; Fri, 24 Nov 2017 05:02:08 -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 282CE60726; Fri, 24 Nov 2017 13:02:08 +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=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, 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 930296083F; Fri, 24 Nov 2017 13:00:37 +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 8717C60726; Fri, 24 Nov 2017 13:00:18 +0000 (UTC) Received: from forward105j.mail.yandex.net (forward105j.mail.yandex.net [5.45.198.248]) by lists.linaro.org (Postfix) with ESMTPS id 7725A60812 for ; Fri, 24 Nov 2017 13:00:11 +0000 (UTC) Received: from mxback4j.mail.yandex.net (mxback4j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10d]) by forward105j.mail.yandex.net (Yandex) with ESMTP id 6F41C183477 for ; Fri, 24 Nov 2017 16:00:08 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback4j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id SFYgx7EvM1-089OYu3A; Fri, 24 Nov 2017 16:00:08 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id N2PeGhXtlr-07oWEPVe; Fri, 24 Nov 2017 16:00:07 +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: Fri, 24 Nov 2017 16:00:04 +0300 Message-Id: <1511528406-25262-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511528406-25262-1-git-send-email-odpbot@yandex.ru> References: <1511528406-25262-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 310 Subject: [lng-odp] [PATCH API-NEXT v1 1/3] api: time: time difference in nsec 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: Petri Savolainen Added function which returns time difference in nanoseconds. This short cuts a common pattern... t1 = odp_time_global(); foo(); t2 = odp_time_global(); printf("foo() takes %u nsec\n", odp_time_diff_ns(t2, t1); ... by combining convert and diff functions. Signed-off-by: Petri Savolainen --- /** Email created from pull request 310 (psavol:next-time-convert) ** https://github.com/Linaro/odp/pull/310 ** Patch: https://github.com/Linaro/odp/pull/310.patch ** Base sha: b95e7d08043ba45d12635c5afaa3fbf3a07ecc90 ** Merge commit sha: 7700d0dab4af4db47973c2a88e5a6d6765bf979e **/ include/odp/api/spec/time.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/odp/api/spec/time.h b/include/odp/api/spec/time.h index 29175eb5a..50082f53a 100644 --- a/include/odp/api/spec/time.h +++ b/include/odp/api/spec/time.h @@ -76,6 +76,16 @@ odp_time_t odp_time_global(void); */ odp_time_t odp_time_diff(odp_time_t t2, odp_time_t t1); +/** + * Time difference in nanoseconds + * + * @param t2 Second time stamp + * @param t1 First time stamp + * + * @return Difference of time stamps (t2 - t1) in nanoseconds + */ +uint64_t odp_time_diff_ns(odp_time_t t2, odp_time_t t1); + /** * Time sum * From patchwork Fri Nov 24 13:00:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 119578 Delivered-To: patch@linaro.org Received: by 10.80.225.132 with SMTP id k4csp2133838edl; Fri, 24 Nov 2017 05:01:16 -0800 (PST) X-Google-Smtp-Source: AGs4zMa8czmIi//HeWz88ndJ0hls/maRGbTOeKkmvuRPIQbqjUlgx94NsI9xr/TlpMImjtpOo6PT X-Received: by 10.55.212.201 with SMTP id s70mr44647766qks.157.1511528476191; Fri, 24 Nov 2017 05:01:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511528476; cv=none; d=google.com; s=arc-20160816; b=MuSD2CqWvN0iJfIpKFaB3bUR8UrjIfG6sZTla65LY7HDhyqB/vya/9PisPOS4ZNoBh aE3rouXYklL68tZrRc7ssilvbw9eiVtogHo7DdSY8Ld7MEJ1vQKfs6HoLkYdh/c+ZWDC bJuUVf7coL+Q9y58lpvApBYSWM5hcpnUUng4EcUx8rjTefvbQtHD4Cm7JrpZPH0zaNFY 3l/CUAl7JfDtzWGFxmE8+hAscPb/acK6f54XcwEBjPfxFK47LZ+FgykJqKCPlBGOmnIy JnrG8qv9KCyRLNr7u5+KXoKNjilDsJHKKyCnfye5ZTfqI13h5N4scdK7e4p/yU8NilpR TzvQ== 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=aovs6HiPzGo8qzR64cT8VRRQPCsPqcdDOoH73UM2Tjo=; b=wH673SnqNWGJpXSeeviYpRsP3d8g1DAee8f5IkjXpw7YzUxCg8uL1Swk7gEOtriixY vbb33nDrMYnd2nm5fo4pqzFTC2PNj2DbSDAHSC8h87Iky60iXqu/oCyNBl2MV+UkxUPU WG+l64XP9n79lTqtY/Rc5iVsuCX5wMbeO6xqXkZTf5njlhXAbNiEDj92F5j0xAMqQ13q pzWFI/UVAaHeNa1xC4FyR9rnRNkmx1b8IuZ1d8uegBHTpicTfHGKT9nU1iMTVsiWbAfy z6w54JFrRSkibox9ZC6PBpt+Z2/Epr/TXN3oD+T3pg5tCt07Zb/flmz4Hz+Utj9ibnM+ XE/w== 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 s34si695765qtj.94.2017.11.24.05.01.15; Fri, 24 Nov 2017 05:01:16 -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 A7C1760890; Fri, 24 Nov 2017 13:01: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.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 3C61D60830; Fri, 24 Nov 2017 13:00:30 +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 6F19660816; Fri, 24 Nov 2017 13:00:16 +0000 (UTC) Received: from forward102p.mail.yandex.net (forward102p.mail.yandex.net [77.88.28.102]) by lists.linaro.org (Postfix) with ESMTPS id 905F460726 for ; Fri, 24 Nov 2017 13:00:10 +0000 (UTC) Received: from mxback2j.mail.yandex.net (mxback2j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10b]) by forward102p.mail.yandex.net (Yandex) with ESMTP id 191144302356 for ; Fri, 24 Nov 2017 16:00:09 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback2j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 0bCBBhVLI9-09ViGGRD; Fri, 24 Nov 2017 16:00:09 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id N2PeGhXtlr-08o8GG4s; Fri, 24 Nov 2017 16:00:08 +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: Fri, 24 Nov 2017 16:00:05 +0300 Message-Id: <1511528406-25262-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511528406-25262-1-git-send-email-odpbot@yandex.ru> References: <1511528406-25262-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 310 Subject: [lng-odp] [PATCH API-NEXT v1 2/3] linux-gen: time: implement odp_time_diff_ns 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: Petri Savolainen Implemented the new diff in nsec function. Signed-off-by: Petri Savolainen --- /** Email created from pull request 310 (psavol:next-time-convert) ** https://github.com/Linaro/odp/pull/310 ** Patch: https://github.com/Linaro/odp/pull/310.patch ** Base sha: b95e7d08043ba45d12635c5afaa3fbf3a07ecc90 ** Merge commit sha: 7700d0dab4af4db47973c2a88e5a6d6765bf979e **/ platform/linux-generic/odp_time.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/platform/linux-generic/odp_time.c b/platform/linux-generic/odp_time.c index 0df4682c3..04fedf5fa 100644 --- a/platform/linux-generic/odp_time.c +++ b/platform/linux-generic/odp_time.c @@ -228,6 +228,15 @@ odp_time_t odp_time_diff(odp_time_t t2, odp_time_t t1) return time; } +uint64_t odp_time_diff_ns(odp_time_t t2, odp_time_t t1) +{ + odp_time_t time; + + time.u64 = t2.u64 - t1.u64; + + return time_to_ns(time); +} + uint64_t odp_time_to_ns(odp_time_t time) { return time_to_ns(time); From patchwork Fri Nov 24 13:00:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 119580 Delivered-To: patch@linaro.org Received: by 10.80.225.132 with SMTP id k4csp2137513edl; Fri, 24 Nov 2017 05:03:37 -0800 (PST) X-Google-Smtp-Source: AGs4zMaG5yAuV3kmFjz2MG7C6vtT+iaiFt8vwtqdr9XuuRJMX+RCQui+gtPESwxDyqs7yJhBcAvn X-Received: by 10.233.223.2 with SMTP id t2mr42701663qkf.331.1511528616884; Fri, 24 Nov 2017 05:03:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511528616; cv=none; d=google.com; s=arc-20160816; b=VH7BZoiVbZwDcJaMK1EoMV0vtVIcKUvQYhlFVKe4KCUtcxjy6AMDbd8sGijDyePeeH ZFQSKltynUT7vV9zI1hSnspiJrLvrIG5dg9m1hkJqwaExP3+0UxChPj30BuHxKO0INg2 x9EGQtxDL0SHUuUkZmu4IxMRNwaRG6BQ3GznYQSbCMaK/mLwnz/ov3wlLGj7ER1PYI0u dgLIPpY8CrZiKR3TuP/wKPllLyJ3d2QS5dw+BIpVsZ/tBrjwdO50BSzpqR8eE/pYQGBb +fS9wtvnpssesgkkDnU52RAlj/Y4VlXm+s7yZ9y1J58bK43XZOBsFPWTjExSpuq6+dgN BBpQ== 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=oLw4M7GoXmXjmkWfGO7a+7gkVBlFy5UTFTx4Q5JttaQ=; b=WOWqUEUn8Z3OU/eyMwO6nRATqhINLu1YpYGcm0audrupzTerXrJ7CWeUr6v1eEU+EJ ouQgaVWOrWz2NyKAjjsAGr083+UXy+Mi8d9QLHGUiyStAGqCQXNchqXhlYqXq5GWiua6 kP6NoHmqDCWgSXa43V0EhjO6f6EmAdHOaI3qAw+fP5rua1JFUBODw6OOqnMRkVpWUqJJ xWNfA0uaTUuQC2SpZbE/8Rj+c6aRgFPu/21B2QXMn2JRWe1usmbeMvOIBiLigBkwk3If JvP+gfN0+4NStQRYp7ubUgmc/kEqSeHGuRVLtx347KjqZmU/gMc4NbOSMhETW8igd9Ag d3HQ== 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 q32si2036269qkq.242.2017.11.24.05.03.36; Fri, 24 Nov 2017 05:03:36 -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 67FF2608DF; Fri, 24 Nov 2017 13:03:36 +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,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 3354960833; Fri, 24 Nov 2017 13:02:14 +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 82BAD608A7; Fri, 24 Nov 2017 13:02:04 +0000 (UTC) Received: from forward104o.mail.yandex.net (forward104o.mail.yandex.net [37.140.190.179]) by lists.linaro.org (Postfix) with ESMTPS id 0E26C60726 for ; Fri, 24 Nov 2017 13:00:36 +0000 (UTC) Received: from mxback5o.mail.yandex.net (mxback5o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::1f]) by forward104o.mail.yandex.net (Yandex) with ESMTP id 7B38A702149 for ; Fri, 24 Nov 2017 16:00:34 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback5o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id xgwIQiBdXo-09GGkDeR; Fri, 24 Nov 2017 16:00:10 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id N2PeGhXtlr-09ouiL3t; Fri, 24 Nov 2017 16:00:09 +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: Fri, 24 Nov 2017 16:00:06 +0300 Message-Id: <1511528406-25262-4-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511528406-25262-1-git-send-email-odpbot@yandex.ru> References: <1511528406-25262-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 310 Subject: [lng-odp] [PATCH API-NEXT v1 3/3] validation: time: test odp_time_diff_ns 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: Petri Savolainen Added tests for the new time difference in nsec function. Signed-off-by: Petri Savolainen --- /** Email created from pull request 310 (psavol:next-time-convert) ** https://github.com/Linaro/odp/pull/310 ** Patch: https://github.com/Linaro/odp/pull/310.patch ** Base sha: b95e7d08043ba45d12635c5afaa3fbf3a07ecc90 ** Merge commit sha: 7700d0dab4af4db47973c2a88e5a6d6765bf979e **/ test/validation/api/time/time.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/test/validation/api/time/time.c b/test/validation/api/time/time.c index ef1372578..c8f90dbac 100644 --- a/test/validation/api/time/time.c +++ b/test/validation/api/time/time.c @@ -201,7 +201,8 @@ static void time_test_diff(time_cb time_cur, /* volatile to stop optimization of busy loop */ volatile int count = 0; odp_time_t diff, t1, t2; - uint64_t nsdiff, ns1, ns2, ns; + uint64_t ns1, ns2, ns; + uint64_t nsdiff, diff_ns; uint64_t upper_limit, lower_limit; /* test timestamp diff */ @@ -217,6 +218,9 @@ static void time_test_diff(time_cb time_cur, diff = odp_time_diff(t2, t1); CU_ASSERT(odp_time_cmp(diff, ODP_TIME_NULL) > 0); + diff_ns = odp_time_diff_ns(t2, t1); + CU_ASSERT(diff_ns > 0); + ns1 = odp_time_to_ns(t1); ns2 = odp_time_to_ns(t2); ns = ns2 - ns1; @@ -225,6 +229,7 @@ static void time_test_diff(time_cb time_cur, upper_limit = ns + 2 * res; lower_limit = ns - 2 * res; CU_ASSERT((nsdiff <= upper_limit) && (nsdiff >= lower_limit)); + CU_ASSERT((diff_ns <= upper_limit) && (diff_ns >= lower_limit)); /* test timestamp and interval diff */ ns1 = 54; @@ -233,11 +238,16 @@ static void time_test_diff(time_cb time_cur, diff = odp_time_diff(t2, t1); CU_ASSERT(odp_time_cmp(diff, ODP_TIME_NULL) > 0); + + diff_ns = odp_time_diff_ns(t2, t1); + CU_ASSERT(diff_ns > 0); + nsdiff = odp_time_to_ns(diff); upper_limit = ns + 2 * res; lower_limit = ns - 2 * res; CU_ASSERT((nsdiff <= upper_limit) && (nsdiff >= lower_limit)); + CU_ASSERT((diff_ns <= upper_limit) && (diff_ns >= lower_limit)); /* test interval diff */ ns2 = 60 * 10 * ODP_TIME_SEC_IN_NS; @@ -246,11 +256,16 @@ static void time_test_diff(time_cb time_cur, t2 = time_from_ns(ns2); diff = odp_time_diff(t2, t1); CU_ASSERT(odp_time_cmp(diff, ODP_TIME_NULL) > 0); + + diff_ns = odp_time_diff_ns(t2, t1); + CU_ASSERT(diff_ns > 0); + nsdiff = odp_time_to_ns(diff); upper_limit = ns + 2 * res; lower_limit = ns - 2 * res; CU_ASSERT((nsdiff <= upper_limit) && (nsdiff >= lower_limit)); + CU_ASSERT((diff_ns <= upper_limit) && (diff_ns >= lower_limit)); /* same time has to diff to 0 */ diff = odp_time_diff(t2, t2); @@ -258,6 +273,9 @@ static void time_test_diff(time_cb time_cur, diff = odp_time_diff(t2, ODP_TIME_NULL); CU_ASSERT(odp_time_cmp(t2, diff) == 0); + + diff_ns = odp_time_diff_ns(t2, t2); + CU_ASSERT(diff_ns == 0); } void time_test_local_diff(void)