From patchwork Mon Sep 4 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: 111593 Delivered-To: patch@linaro.org Received: by 10.140.94.166 with SMTP id g35csp1507954qge; Mon, 4 Sep 2017 06:08:01 -0700 (PDT) X-Google-Smtp-Source: ADKCNb5vvUENgcCzOqJdrjW22uJB7yoVOoHuyBIxeikSjpL91vdhZuRvZKlEWqs+tYtPCv/2e44y X-Received: by 10.55.3.133 with SMTP id 127mr820256qkd.42.1504530481474; Mon, 04 Sep 2017 06:08:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504530481; cv=none; d=google.com; s=arc-20160816; b=rYYAU6S1iSV71hpaKWT7JvrrnuiNYsiMF6B5dWFcS/SolvFn+u9BT8GO9Cgpj5uwVN hbKCDtIU/oc09G4R121kq+yrwkUuPiYk5SW6I2yUPKqgDuU6qPd5leoDN5cENPsTbe1X mjObrN+ClJqVjDTvsSr9DTZ1TdWOjuhJoDMUHL3EyrO89dTvZfZXk5OVO+rxT/P15rZK SkqW1kzS30XWivdsENfMRt8FdzbVMguW4nGxOrbuQ3Ar1RQ/qdaKeT6Szk+eP1k6Pe8s Cl0S3cZjA7y8f2k85v7m8omU59o+FOM2TtuktmJf0q1/az9XDyMD1/PQ35iA5/3PKDW9 D9AQ== 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=D8xwt9mgZcNnqfG5lM4VfBsGJEVCLg468rmWJ6ru9fg=; b=GO8Ld+sTqK/0EKyBnvHDoRJS/JLZkPFKSCHTICvkRsKYOYHCBRiPF5o372uWBE2nte BYWPSFBNyFEdg0VWeL59hXqcH0FqiPKFCTO4LJKrIAVQUcJX+IhuGt1mNae8x3iPA1TM Vdfi+ct1wnd/xVNaxf53Me8cwSKyolyXo65wGZSWEElqr5JA0oxdYJOEktSX0bWqqNvs iL5BS+HC625F/6HkPF1PyN+3KVMSfJJBXaF8wwHMcP1ge5ErgAWQjR9Dks8atGP+hk/c YehreZ9pfDH2RaYj8wcqScjpYxxO4PDU8+hJy0SSAS8h1rcKlkpfQSBW15O4xYD14a/Y eSBA== 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 t68si5523842qkb.307.2017.09.04.06.08.00; Mon, 04 Sep 2017 06:08:01 -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 3259C60C01; Mon, 4 Sep 2017 13:08:00 +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 EDD3260C92; Mon, 4 Sep 2017 13:05:39 +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 B5C2660CC1; Mon, 4 Sep 2017 13:05:20 +0000 (UTC) Received: from forward4j.cmail.yandex.net (forward4j.cmail.yandex.net [5.255.227.22]) by lists.linaro.org (Postfix) with ESMTPS id D5C4660CC1 for ; Mon, 4 Sep 2017 13:00:15 +0000 (UTC) Received: from smtp1o.mail.yandex.net (smtp1o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::25]) by forward4j.cmail.yandex.net (Yandex) with ESMTP id 663FA20E9A for ; Mon, 4 Sep 2017 16:00:14 +0300 (MSK) Received: from smtp1o.mail.yandex.net (localhost.localdomain [127.0.0.1]) by smtp1o.mail.yandex.net (Yandex) with ESMTP id 006E51300CC1 for ; Mon, 4 Sep 2017 16:00:12 +0300 (MSK) Received: by smtp1o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id C5LD3hyGSv-0Bs8D8T9; Mon, 04 Sep 2017 16:00:11 +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: Mon, 4 Sep 2017 16:00:06 +0300 Message-Id: <1504530006-8429-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1504530006-8429-1-git-send-email-odpbot@yandex.ru> References: <1504530006-8429-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 157 Subject: [lng-odp] [PATCH v7 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: 2679354c415eb41ed8f4272740f17284fe165de3 **/ example/generator/odp_generator.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index f3ec43be..1cddc92c 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; int verbose_interval = 20; odp_thrmask_t thrd_mask; @@ -786,8 +787,15 @@ 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); + if (stall / ODP_TIME_SEC_IN_NS) + sleep(1); + else + usleep(stall / ODP_TIME_USEC_IN_NS); continue; + } next = odp_time_sum(cur, wait); switch (args->appl.mode) {