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 *