From patchwork Thu Aug 31 14: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: 111405 Delivered-To: patch@linaro.org Received: by 10.140.95.112 with SMTP id h103csp2594412qge; Thu, 31 Aug 2017 07:01:22 -0700 (PDT) X-Google-Smtp-Source: ADKCNb6JSq77ZZFsK8dK0P30BH8pHGjmrRmWuLuvzRhLmPg85xUSabLR3PHCcs82ylqAXAP1cnH0 X-Received: by 10.107.9.209 with SMTP id 78mr1740251ioj.99.1504188081854; Thu, 31 Aug 2017 07:01:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504188081; cv=none; d=google.com; s=arc-20160816; b=XqLUV8VfgQh4mw1r2DKI3rlj5BNYLHXa1a3vBJGc6e3PbmeatqzWDIEabDYBVpTYtT M9cNyKAvaP2a04Br7SgXIh4GmsEN78cwqPBM2j47HbSEP4ifVSslZw1zGgn3SxgN24ZZ ICIRUHeiqb8S4vukNhRB1R9cpSuQzTkIxNbMqgbuOzVQhDL+8AEj6Ir3ffv7922G9hNh U3XDCTjGoT8LXb86bd6ulasY9TNvo+uVnZujpRh/yZ5cV3Ii4BZSRMxRRgqIDlrw/IvL RIwr8XrRMQsH0BxKgJc4d+vbUxNfRe4nKOi46YLpTrbeTk3Ap4a7GmqPN9cn2StJZCBZ 4Vug== 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=wRxdOsONr1pq4jrXUzgaoeAqwa9FqJuG47bEg+7DZGM=; b=Q2m+loXmotxvmj+O3IaYQELYcEqpjBmPzQaNCuOyoPFplFV0yR4jG4d38JTOATLzOO Id6gjoi5eRWWJlF766uGaFGz6yfGWPfOOPOTNSchU0aRHANn08h/z2jsa2i3Ncml3CCw jZ42m9fsv8NijLSjxUfW+XhM+tmmHWY6iKyG2uqzHDj4gEIQLOJl/v46O2o5GVzZtbUx u4byBwSSv8qDWRd93nhTjexB2qH3E7C+TeVK6w6eM2yaUzgNaoPHysO7i5FNk3i6Et2b Y0KN5Ki5krNq8rL3Hhh0M84jwi15L+R5bLNI+NZjilIiIcMRrcf+h9DmUPu+LhO6I3iB ujMg== ARC-Authentication-Results: i=1; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id c11si211019iti.59.2017.08.31.07.01.21; Thu, 31 Aug 2017 07:01:21 -0700 (PDT) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 600446090D; Thu, 31 Aug 2017 14:01:21 +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 4561662ECB; Thu, 31 Aug 2017 14:00:35 +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 4CF20635D3; Thu, 31 Aug 2017 14:00:30 +0000 (UTC) Received: from forward2j.cmail.yandex.net (forward2j.cmail.yandex.net [5.255.227.20]) by lists.linaro.org (Postfix) with ESMTPS id 4377662ECB for ; Thu, 31 Aug 2017 14:00:22 +0000 (UTC) Received: from smtp1p.mail.yandex.net (smtp1p.mail.yandex.net [77.88.29.84]) by forward2j.cmail.yandex.net (Yandex) with ESMTP id 7D1F120E79 for ; Thu, 31 Aug 2017 17:00:20 +0300 (MSK) Received: from smtp1p.mail.yandex.net (localhost.localdomain [127.0.0.1]) by smtp1p.mail.yandex.net (Yandex) with ESMTP id C3A5D1780B0F for ; Thu, 31 Aug 2017 17:00:19 +0300 (MSK) Received: by smtp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id HQWiqSnwLS-0It8NDJV; Thu, 31 Aug 2017 17:00:18 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) X-Yandex-Suid-Status: 1 0 From: Github ODP bot To: lng-odp@lists.linaro.org Date: Thu, 31 Aug 2017 17:00:06 +0300 Message-Id: <1504188006-18423-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1504188006-18423-1-git-send-email-odpbot@yandex.ru> References: <1504188006-18423-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 157 Subject: [lng-odp] [PATCH v3 1/1] odp-generator: Use clock related functions less when printing 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: Ilias Apalodimas Using odp_time_local() on each iteration consumes too much cpu for no reason Netmap pktio reported ~550kpps prior to this and ~1.2Mpps after the patch, when odp_generator was used as a receiver. Signed-off-by: Ilias Apalodimas --- /** Email created from pull request 157 (apalos:gen_cpu_fix) ** https://github.com/Linaro/odp/pull/157 ** Patch: https://github.com/Linaro/odp/pull/157.patch ** Base sha: 7508c5ac906bb7cb1d339b4c5e924f3a18e504ca ** Merge commit sha: 4eecf4689a08a0096783b4e5b98f0d2ca4c82e35 **/ example/generator/odp_generator.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index f3ec43be..d89bb87a 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -765,11 +765,12 @@ static int gen_recv_thread(void *arg) */ static void print_global_stats(int num_workers) { - odp_time_t cur, wait, next; + odp_time_t cur, wait, next, left; uint64_t pkts_snd = 0, pkts_snd_prev = 0; uint64_t pps_snd = 0, maximum_pps_snd = 0; uint64_t pkts_rcv = 0, pkts_rcv_prev = 0; uint64_t pps_rcv = 0, maximum_pps_rcv = 0; + uint64_t stall = 0; int verbose_interval = 20; odp_thrmask_t thrd_mask; @@ -786,8 +787,14 @@ static void print_global_stats(int num_workers) } cur = odp_time_local(); - if (odp_time_cmp(next, cur) > 0) + if (odp_time_cmp(next, cur) > 0) { + left = odp_time_diff(next, cur); + stall = odp_time_to_ns(left); + stall = (stall / 1000000000) + 1; + stall &= 0xFFFFFFFF; + sleep((unsigned int)stall); continue; + } next = odp_time_sum(cur, wait); switch (args->appl.mode) {