From patchwork Sat Jan 18 19:32:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Honnappa Nagarahalli X-Patchwork-Id: 182886 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp797342ile; Sat, 18 Jan 2020 11:33:19 -0800 (PST) X-Google-Smtp-Source: APXvYqxfYrDpQMO+B3mNdqHf5CJ/DZCW8HOY87Gm9amUVZ3qHxjDvo1Jm/hqQ/P4SZYPa8bXlVTF X-Received: by 2002:a50:bf46:: with SMTP id g6mr10523131edk.379.1579375999759; Sat, 18 Jan 2020 11:33:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579375999; cv=none; d=google.com; s=arc-20160816; b=hVPN73FFM/3tZOPJfTPz1HFkFlF7bS5jMSieUfAkRrm9umPHMuJE7pkN+TySs0kAuX hHWRBVh4yvgjG9R6/xFoK7KKvMawCliC/QnZl/Ska9/slO/8UV1eRHAf7XCcukHMlC9Q X0dZmC1/h1oWbxEMhdI19aa9fh/rO8j5sYN6oKT10LEtkyEDlOw5DSe+MnGzBSrRka/s Suo2qNGlq67iSlLaBTdksMk5u2Wj4PggCk46o/YW2KornIt5q7d8hlrUaIpxm6YdB+K3 Nw9N8RUCbO/Pq/PXsql6SRrxEhTYxpXqq/Du7WjHq3JjUkMB/UHgPu2B3l+0N8uciqVq dY8Q== 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:references:in-reply-to :message-id:date:cc:to:from; bh=kd7M+tGi71+uowfc/4q4UKVLJ2kQBU3mxqjzQTW71bM=; b=0m0iJDv5vgQwVRd7r4qwXr1sbL9xOhaJe+Lh3bcd1xVOzBLpy73r0vOY1HHshI504x YZPHSnmdimoFKJ3no6GDPeXsBDJofAduXfKm2TIN1IX8J3+dRyr325Tw7eeCK633d3r9 N5ZJlaehQeNW35xOsbqkBlgN60TRO6/CDLacjX79b2xNWR27R45GvguaMGNRbuJPoRx4 OKhJ/zn30BQWxSiJwylJcOBhaKOxANlsU+fMFOTUuZm+dwII5iBE4bsjgFELGL3nzdAG b17TNxGDBeOovY6t32XlMcWx6NUcONtZ+W/XnySP5PnOujb8bxxjRQuuytaqI1paSyNi oWmA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org Return-Path: Received: from dpdk.org (dpdk.org. [92.243.14.124]) by mx.google.com with ESMTP id r19si20148423ejb.156.2020.01.18.11.33.19; Sat, 18 Jan 2020 11:33:19 -0800 (PST) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) client-ip=92.243.14.124; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6D9E61BECF; Sat, 18 Jan 2020 20:33:12 +0100 (CET) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id 64E5B1BEB2 for ; Sat, 18 Jan 2020 20:33:10 +0100 (CET) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B03C931B; Sat, 18 Jan 2020 11:33:09 -0800 (PST) Received: from qc2400f-1.austin.arm.com (qc2400f-1.austin.arm.com [10.118.14.48]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9D8A83F6C4; Sat, 18 Jan 2020 11:33:09 -0800 (PST) From: Honnappa Nagarahalli To: olivier.matz@6wind.com, sthemmin@microsoft.com, jerinj@marvell.com, bruce.richardson@intel.com, david.marchand@redhat.com, pbhagavatula@marvell.com, konstantin.ananyev@intel.com, yipeng1.wang@intel.com, drc@linux.vnet.ibm.com, honnappa.nagarahalli@arm.com Cc: dev@dpdk.org, dharmik.thakkar@arm.com, ruifeng.wang@arm.com, gavin.hu@arm.com, nd@arm.com Date: Sat, 18 Jan 2020 13:32:42 -0600 Message-Id: <20200118193247.43831-2-honnappa.nagarahalli@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200118193247.43831-1-honnappa.nagarahalli@arm.com> References: <20190906190510.11146-1-honnappa.nagarahalli@arm.com> <20200118193247.43831-1-honnappa.nagarahalli@arm.com> Subject: [dpdk-dev] [PATCH v10 1/6] test/ring: use division for cycle count calculation X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Use division instead of modulo operation to calculate more accurate cycle count. Signed-off-by: Honnappa Nagarahalli Acked-by: Olivier Matz --- app/test/test_ring_perf.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) -- 2.17.1 diff --git a/app/test/test_ring_perf.c b/app/test/test_ring_perf.c index 70ee46ffe..6c2aca483 100644 --- a/app/test/test_ring_perf.c +++ b/app/test/test_ring_perf.c @@ -357,10 +357,10 @@ test_single_enqueue_dequeue(struct rte_ring *r) } const uint64_t mc_end = rte_rdtsc(); - printf("SP/SC single enq/dequeue: %"PRIu64"\n", - (sc_end-sc_start) >> iter_shift); - printf("MP/MC single enq/dequeue: %"PRIu64"\n", - (mc_end-mc_start) >> iter_shift); + printf("SP/SC single enq/dequeue: %.2F\n", + ((double)(sc_end-sc_start)) / iterations); + printf("MP/MC single enq/dequeue: %.2F\n", + ((double)(mc_end-mc_start)) / iterations); } /* @@ -395,13 +395,15 @@ test_burst_enqueue_dequeue(struct rte_ring *r) } const uint64_t mc_end = rte_rdtsc(); - uint64_t mc_avg = ((mc_end-mc_start) >> iter_shift) / bulk_sizes[sz]; - uint64_t sc_avg = ((sc_end-sc_start) >> iter_shift) / bulk_sizes[sz]; + double mc_avg = ((double)(mc_end-mc_start) / iterations) / + bulk_sizes[sz]; + double sc_avg = ((double)(sc_end-sc_start) / iterations) / + bulk_sizes[sz]; - printf("SP/SC burst enq/dequeue (size: %u): %"PRIu64"\n", bulk_sizes[sz], - sc_avg); - printf("MP/MC burst enq/dequeue (size: %u): %"PRIu64"\n", bulk_sizes[sz], - mc_avg); + printf("SP/SC burst enq/dequeue (size: %u): %.2F\n", + bulk_sizes[sz], sc_avg); + printf("MP/MC burst enq/dequeue (size: %u): %.2F\n", + bulk_sizes[sz], mc_avg); } }