From patchwork Fri Dec 20 04:45:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Honnappa Nagarahalli X-Patchwork-Id: 182199 Delivered-To: patch@linaro.org Received: by 2002:a92:1f98:0:0:0:0:0 with SMTP id f24csp57371ilf; Thu, 19 Dec 2019 20:46:00 -0800 (PST) X-Google-Smtp-Source: APXvYqze2paty6WKLqKjQADTvDRLeSZhdwgQVQeG9lbz4hGv82yP8F2GxECWZ1cETki8dw0qZ1bQ X-Received: by 2002:a1c:770e:: with SMTP id t14mr14803260wmi.101.1576817160889; Thu, 19 Dec 2019 20:46:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576817160; cv=none; d=google.com; s=arc-20160816; b=VaZ7p4MNxOvAnL+P8QNVAJhvNfctPKJjZ8OtpimzmmXQ7xuPDpZos7cQJoKkbhJqIQ 6Xc51NggEiZaysKwIyOEERJHVF3KqjQGWWBMWEVz08QXlEnBz/KXQ+qZ0GB+6AGxEXfB F7UaAHLRySTvOCU3ebIq/53SIxxtGZeDTKHd7JmjF6Pm5Sebm7f2n9AsU7AU7VcMiRw4 /HGpYko8/mS18nzuilXS2lzy8aLx7u/3aXMeEzB76QoCYOiS64VPH3JHyCtTnqrZIgl+ deLitjvecYYWuB635dc+GQG9GIplwK0LpNOdoJffdze0qAvWipfKWCnu4IV1XMNS6wZJ q93g== 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=FYIY22bYvdu3voLkazCHShUf+gmgnNUqd5q3e6nOCtW73HFyIMmH+g/GVg+zrF2Xg4 z2qi2QJTalyKMBsXEnEoDDFNbswqk9x9ZqVh4gRxRMzTKTCUeInUAu6TVsSoy61gsz9M IZIm+gYT94kN4lW3WVyKWgspOJxqD+U+HXiAm4KD2ThSOsPUd++xzetbNiQPJb8m5+ne UbrySU0ffDY5OaM+70KhKozoPpyKrFFSJnq/Df1WNRz2Ky+ALpGDUczkbUAp2EhVL6OW TmyS34HkBKtFfDOJkdcK5Gwx69gsfcp3xlA0IQOoGHhWj/R8Ge9NWF/EgUE/l6Pp03wR N9cA== 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 o4si8052638wrs.308.2019.12.19.20.46.00; Thu, 19 Dec 2019 20:46:00 -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 2CF161BF74; Fri, 20 Dec 2019 05:46:00 +0100 (CET) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id 0E2AD1BE8E for ; Fri, 20 Dec 2019 05:45:58 +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 C77851FB; Thu, 19 Dec 2019 20:45:56 -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 B53BA3F718; Thu, 19 Dec 2019 20:45:56 -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, honnappa.nagarahalli@arm.com Cc: dev@dpdk.org, dharmik.thakkar@arm.com, ruifeng.wang@arm.com, gavin.hu@arm.com, nd@arm.com Date: Thu, 19 Dec 2019 22:45:08 -0600 Message-Id: <20191220044524.32910-2-honnappa.nagarahalli@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191220044524.32910-1-honnappa.nagarahalli@arm.com> References: <20190906190510.11146-1-honnappa.nagarahalli@arm.com> <20191220044524.32910-1-honnappa.nagarahalli@arm.com> Subject: [dpdk-dev] [PATCH v7 01/17] 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); } }