From patchwork Thu Aug 31 15: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: 111409 Delivered-To: patch@linaro.org Received: by 10.140.95.112 with SMTP id h103csp2680967qge; Thu, 31 Aug 2017 08:01:40 -0700 (PDT) X-Google-Smtp-Source: ADKCNb4vry13CwTkPM1c/MVKkL0dytsAyFpEXIZFMsBcaAvW3YBNzZJVn+utNJ47qXQFFuFA5IxV X-Received: by 10.55.73.130 with SMTP id w124mr3889725qka.29.1504191700344; Thu, 31 Aug 2017 08:01:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504191700; cv=none; d=google.com; s=arc-20160816; b=IbP/e0kKruVTGNJ54jlu3/5CF0e0qiiDHkwp/jIfR+CD+nhJQ/gKL2bp/1gb69DZG4 sZmlh4ibPI2U/xADMOo9K5sTF0rfUaxdUpyAiE9IZxfgks1WomFnmaA5qLHeMVShjs5H TGnb9j85GnuNYo/EwVaK7ltDitl5XLPHsTorQuDUnQ9UBHvGpKTDAEEYn2CYT8JKqQ1e Ua5IicxjOFj7NRbRV1Bt5Oc9A2jyYWqyuHae6NZwuErIqn4bwPWhhCzG9Ir9gBP0t78w HRlGr/d+x1OHfhn8uMr4qN2N+lOIzE+SkdXwBaNSqkfexi6coHUvMiVrFemhfNqC34Eh mP1Q== 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=hAWUmfnm3PfyAe7vy3IBKVG+Fa6SGVj9AmTOu4FW0pA=; b=OQrdp1tJZr5Td+pdqN4HAyBOmoIaTN8Kxs91So0/zuK9GbDS437BvuPq9IlFD3dMkb 4pkF8vlrcOvcUhqz8wRTHvNYhMXN55pkMYXpYa2IdcbKu+any6mwFl5NIQ1EuVTN5zht gzW2lsKF5uxiwoED0rBCbOpBveBSllZ3zj5QP95fZGRrS9e2pe7KDfzYpM/MccanfIPd MgG3Og9674MTTd/3S5etl/KHH2oIokKTQrrR5TWjM1xBKy97yVUN/ajpaQNvdw+OxvPG WqC+2rkchdi/0EtwnZwTJ4dD9jKizSk7oriVYWSK6lwcI0FIkSfzxJwpGHAycPlEdOXe kDow== 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 76si4390978qkz.314.2017.08.31.08.01.40; Thu, 31 Aug 2017 08:01:40 -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 DF08464450; Thu, 31 Aug 2017 15:01:39 +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 B257460B2D; Thu, 31 Aug 2017 15:00:33 +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 E365F60AFB; Thu, 31 Aug 2017 15:00:24 +0000 (UTC) Received: from forward2o.cmail.yandex.net (forward2o.cmail.yandex.net [37.9.109.243]) by lists.linaro.org (Postfix) with ESMTPS id 86AD060A6D for ; Thu, 31 Aug 2017 15:00:23 +0000 (UTC) Received: from smtp3o.mail.yandex.net (smtp3o.mail.yandex.net [37.140.190.28]) by forward2o.cmail.yandex.net (Yandex) with ESMTP id 1322B212BA for ; Thu, 31 Aug 2017 18:00:22 +0300 (MSK) Received: from smtp3o.mail.yandex.net (localhost.localdomain [127.0.0.1]) by smtp3o.mail.yandex.net (Yandex) with ESMTP id 933582940F23 for ; Thu, 31 Aug 2017 18:00:20 +0300 (MSK) Received: by smtp3o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id k5pNWgGlA1-0JfStqEg; Thu, 31 Aug 2017 18:00:19 +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 18:00:05 +0300 Message-Id: <1504191605-20082-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1504191605-20082-1-git-send-email-odpbot@yandex.ru> References: <1504191605-20082-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 157 Subject: [lng-odp] [PATCH v4 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 a boost from ~550kpps to ~1.2Mpps when odp_generator was used as a receiver on 1Gbit links. 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: 39bce3ac13602c8381bd7dc57b30d7348410b195 **/ 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) {