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

Message ID 20200506215847.7628-1-dharmik.thakkar@arm.com (mailing list archive)
State Superseded, archived
Headers
Series [1/5] app/testpmd: print clock with CPU cycles per pkt |

Checks

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

Commit Message

Dharmik Thakkar May 6, 2020, 9:58 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>
---
 app/test-pmd/testpmd.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
  

Comments

Lukasz Wojciechowski May 6, 2020, 10:48 p.m. UTC | #1
W dniu 06.05.2020 o 23:58, Dharmik Thakkar pisze:
> 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>
> ---
>   app/test-pmd/testpmd.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
> index 99bacddbfdca..9a8cbbd6fc7c 100644
> --- a/app/test-pmd/testpmd.c
> +++ b/app/test-pmd/testpmd.c
> @@ -1953,11 +1953,12 @@ 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 %lu MHz Clock\n",
Please use PRIu64 instead of %lu to keep printing uint64_t portable for 
different hardware, OS and compilers.
>   		       (unsigned int)(fwd_cycles / total_recv),
> -		       fwd_cycles, total_recv);
> +		       fwd_cycles, total_recv, (uint64_t)(rte_get_tsc_hz() / CYC_PER_MHZ));
>   #endif
>   }
>
  
Iremonger, Bernard May 7, 2020, 1:38 p.m. UTC | #2
Hi Dharmik,

> -----Original Message-----
> From: Dharmik Thakkar <dharmik.thakkar@arm.com>
> Sent: Wednesday, May 6, 2020 10:59 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 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>
> ---
>  app/test-pmd/testpmd.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index
> 99bacddbfdca..9a8cbbd6fc7c 100644
> --- a/app/test-pmd/testpmd.c
> +++ b/app/test-pmd/testpmd.c
> @@ -1953,11 +1953,12 @@ 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 %lu MHz
> Clock\n",

Better to use =%"PRIu64" instead of %lu in previous line

>  		       (unsigned int)(fwd_cycles / total_recv),
> -		       fwd_cycles, total_recv);
> +		       fwd_cycles, total_recv, (uint64_t)(rte_get_tsc_hz() /
> +CYC_PER_MHZ));
>  #endif
>  }
> 
> --
> 2.20.1
Better to fix checkpatch the following checkpatch warning:

WARNING:LONG_LINE: line over 80 characters
#77: FILE: app/test-pmd/testpmd.c:1961:
+                      fwd_cycles, total_recv, (uint64_t)(rte_get_tsc_hz() / CYC_PER_MHZ));

Regards,

Bernard.
  

Patch

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 99bacddbfdca..9a8cbbd6fc7c 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1953,11 +1953,12 @@  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 %lu 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
 }