From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 78348A0350; Sat, 9 May 2020 00:39:08 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 98B0A1DA27; Sat, 9 May 2020 00:38:43 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id C13431D9E6 for ; Sat, 9 May 2020 00:38:36 +0200 (CEST) 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 0AED01045; Fri, 8 May 2020 15:38:36 -0700 (PDT) Received: from dp6132.usa.Arm.com (dp6132.usa.arm.com [10.118.91.150]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0526D3F68F; Fri, 8 May 2020 15:38:36 -0700 (PDT) From: Dharmik Thakkar To: Wenzhuo Lu , Jingjing Wu , Bernard Iremonger Cc: dev@dpdk.org, nd@arm.com, Dharmik Thakkar Date: Fri, 8 May 2020 22:38:26 +0000 Message-Id: <20200508223829.3228-2-dharmik.thakkar@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200508223829.3228-1-dharmik.thakkar@arm.com> References: <20200506215847.7628-1-dharmik.thakkar@arm.com> <20200508223829.3228-1-dharmik.thakkar@arm.com> Subject: [dpdk-dev] [PATCH v2 2/5] app/testpmd: print fractional part in CPU cycles 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" Change printing of CPU cycles/packet to include fractional part for accurateness. Example: Without patch: CPU cycles/packet=14 (total cycles=4899533541 / total RX packets=343031966) With patch: CPU cycles/packet=14.28 (total cycles=4899533541 / total RX packets=343031966) Signed-off-by: Dharmik Thakkar Reviewed-by: Honnappa Nagarahalli Reviewed-by: Phil Yang --- v2: - Change typecast to (double) fwd_cycles / total_recv --- app/test-pmd/testpmd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 806abb805879..a7ac6c66ce1c 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -1955,10 +1955,10 @@ fwd_stats_display(void) #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES #define CYC_PER_MHZ 1E6 if (total_recv > 0) - printf("\n CPU cycles/packet=%u (total cycles=" + printf("\n CPU cycles/packet=%.2F (total cycles=" "%"PRIu64" / total RX packets=%"PRIu64") at %"PRIu64 " MHz Clock\n", - (unsigned int)(fwd_cycles / total_recv), + (double) fwd_cycles / total_recv, fwd_cycles, total_recv, (uint64_t)(rte_get_tsc_hz() / CYC_PER_MHZ)); #endif -- 2.20.1