[v2,1/5] app/testpmd: print clock with CPU cycles per pkt

Message ID 20200508223829.3228-1-dharmik.thakkar@arm.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series [v2,1/5] app/testpmd: print clock with CPU cycles per pkt |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-nxp-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-testing fail Testing issues

Commit Message

Dharmik Thakkar May 8, 2020, 10:38 p.m. UTC
  On aarch64 platforms, the cycles are counted using either a
low-resolution generic counter or a high-resolution PMU cycle counter.
Print the clock frequency along with CPU cycles/packet to identify which
cycle counter is being used.

Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
---
v2:
 - Use %"PRIu64" instead of %lu
 - Fix checkpatch warning

---
 app/test-pmd/testpmd.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
  

Comments

Iremonger, Bernard May 12, 2020, 10:18 a.m. UTC | #1
> -----Original Message-----
> From: Dharmik Thakkar <dharmik.thakkar@arm.com>
> Sent: Friday, May 8, 2020 11:38 PM
> To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Wu, Jingjing
> <jingjing.wu@intel.com>; Iremonger, Bernard
> <bernard.iremonger@intel.com>
> Cc: dev@dpdk.org; nd@arm.com; Dharmik Thakkar
> <dharmik.thakkar@arm.com>
> Subject: [PATCH v2 1/5] app/testpmd: print clock with CPU cycles per pkt
> 
> On aarch64 platforms, the cycles are counted using either a low-resolution
> generic counter or a high-resolution PMU cycle counter.
> Print the clock frequency along with CPU cycles/packet to identify which
> cycle counter is being used.
> 
> Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
> Reviewed-by: Phil Yang <phil.yang@arm.com>

Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
  
Ferruh Yigit May 15, 2020, 12:23 p.m. UTC | #2
On 5/8/2020 11:38 PM, Dharmik Thakkar wrote:
> On aarch64 platforms, the cycles are counted using either a
> low-resolution generic counter or a high-resolution PMU cycle counter.
> Print the clock frequency along with CPU cycles/packet to identify which
> cycle counter is being used.
> 
> Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
> Reviewed-by: Phil Yang <phil.yang@arm.com>

Since 3/5 is independent patch, to not cause that patch hold the patchset, I
will merge rest while we can keep discuss the 3/5.

Except 3/5
Series applied to dpdk-next-net/master, thanks.
  

Patch

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 99bacddbfdca..806abb805879 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1953,11 +1953,14 @@  fwd_stats_display(void)
 	       "%s\n",
 	       acc_stats_border, acc_stats_border);
 #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
+#define CYC_PER_MHZ 1E6
 	if (total_recv > 0)
 		printf("\n  CPU cycles/packet=%u (total cycles="
-		       "%"PRIu64" / total RX packets=%"PRIu64")\n",
+		       "%"PRIu64" / total RX packets=%"PRIu64") at %"PRIu64
+		       " MHz Clock\n",
 		       (unsigned int)(fwd_cycles / total_recv),
-		       fwd_cycles, total_recv);
+		       fwd_cycles, total_recv,
+		       (uint64_t)(rte_get_tsc_hz() / CYC_PER_MHZ));
 #endif
 }