Skip to contentSkip to conversation

app/testpmd: print clock with CPU cycles per pkt

PATCH Superseded Dharmik Thakkar 9 participants 62 messages May 6, 2020 – Sep 10, 2020

lore
Share & tools
lore
#0 lore raw

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.

---
 app/test-pmd/testpmd.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
app/test-pmd/testpmd.c +3 -2
index 99bacddbfdca..9a8cbbd6fc7c 100644
@@ -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
 }
 
Signature · 1 line
2.20.1
#1 lore raw

PATCH 2/5 app/testpmd: print fractional part in CPU cycles

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)

---
 app/test-pmd/testpmd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
app/test-pmd/testpmd.c +2 -2
index 9a8cbbd6fc7c..9444a730a153 100644
@@ -1955,9 +1955,9 @@ 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 %lu MHz Clock\n",
-		       (unsigned int)(fwd_cycles / total_recv),
+		       (double)(fwd_cycles / (double)total_recv),
 		       fwd_cycles, total_recv, (uint64_t)(rte_get_tsc_hz() / CYC_PER_MHZ));
 #endif
 }
Signature · 1 line
2.20.1
#2 lore raw

Re: [dpdk-dev] [PATCH 2/5] app/testpmd: print fractional part in CPU cycles

Quoted 34 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Dharmik Thakkar
Sent: Wednesday, May 6, 2020 10:59 PM
To: Lu, Wenzhuo <[email protected]>; Wu, Jingjing <[email protected]>; Iremonger, Bernard <[email protected]>
Cc: [email protected]; [email protected]; Dharmik Thakkar <[email protected]>
Subject: [dpdk-dev] [PATCH 2/5] app/testpmd: print fractional part in CPU cycles

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)

---
 app/test-pmd/testpmd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
app/test-pmd/testpmd.c +0 -0
index 9a8cbbd6fc7c..9444a730a153 100644

app/test-pmd/testpmd.c fwd_stats_display(void) · line 1960

Quoted 8 lines
app/test-pmd/testpmd.c +2 -2
@@ -1955,9 +1955,9 @@ 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 %lu MHz Clock\n",
-		       (unsigned int)(fwd_cycles / total_recv),
+		       (double)(fwd_cycles / (double)total_recv),

Probably safer long double - to avoid overflow.

Quoted 5 lines
app/test-pmd/testpmd.c +0 -1
 		       fwd_cycles, total_recv, (uint64_t)(rte_get_tsc_hz() / CYC_PER_MHZ));
 #endif
 }
--

2.20.1

#3 lore raw

Re: [dpdk-dev] [PATCH 2/5] app/testpmd: print fractional part in CPU cycles

Hi Konstantin,

Quoted 31 lines · Konstantin
Quoted 30 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Dharmik Thakkar
Sent: Wednesday, May 6, 2020 10:59 PM
To: Lu, Wenzhuo <[email protected]>; Wu, Jingjing <[email protected]>; Iremonger, Bernard <[email protected]>
Cc: [email protected]; [email protected]; Dharmik Thakkar <[email protected]>
Subject: [dpdk-dev] [PATCH 2/5] app/testpmd: print fractional part in CPU cycles

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)

---
app/test-pmd/testpmd.c | 4 ++--

1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 15 lines

app/test-pmd/testpmd.c fwd_stats_display(void) · line 1960

Quoted 13 lines
app/test-pmd/testpmd.c +2 -2
index 9a8cbbd6fc7c..9444a730a153 100644
@@ -1955,9 +1955,9 @@ 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 %lu MHz Clock\n",
-		       (unsigned int)(fwd_cycles / total_recv),
+		       (double)(fwd_cycles / (double)total_recv),

Probably safer long double - to avoid overflow.

Is it possible for a ‘double' to be less than 8 bytes?

Quoted 6 lines
Quoted 6 lines
app/test-pmd/testpmd.c +0 -1
 		       fwd_cycles, total_recv, (uint64_t)(rte_get_tsc_hz() / CYC_PER_MHZ));
 #endif
 }
--

2.20.1

#4 lore raw

Re: [dpdk-dev] [PATCH 2/5] app/testpmd: print fractional part in CPU cycles

Quoted 49 lines

Hi Konstantin,

Quoted 31 lines · Konstantin
Quoted 30 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Dharmik Thakkar
Sent: Wednesday, May 6, 2020 10:59 PM
To: Lu, Wenzhuo <[email protected]>; Wu, Jingjing <[email protected]>; Iremonger, Bernard <[email protected]>
Cc: [email protected]; [email protected]; Dharmik Thakkar <[email protected]>
Subject: [dpdk-dev] [PATCH 2/5] app/testpmd: print fractional part in CPU cycles

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)

---
app/test-pmd/testpmd.c | 4 ++--

1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 15 lines

app/test-pmd/testpmd.c fwd_stats_display(void) · line 1960

Quoted 13 lines
app/test-pmd/testpmd.c +2 -2
index 9a8cbbd6fc7c..9444a730a153 100644
@@ -1955,9 +1955,9 @@ 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 %lu MHz Clock\n",
-		       (unsigned int)(fwd_cycles / total_recv),
+		       (double)(fwd_cycles / (double)total_recv),

Probably safer long double - to avoid overflow.

Quoted 1 line

Is it possible for a ‘double' to be less than 8 bytes?

That was my initial thought - that on some 32 bit systems it could be 4B. Though it seems I was wrong, so feel free to ignore.
BTW, what for double conversion, why not just:
double)(fwd_cycles /total_recv
?

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
app/test-pmd/testpmd.c +0 -1
 		       fwd_cycles, total_recv, (uint64_t)(rte_get_tsc_hz() / CYC_PER_MHZ));
 #endif
 }
--

2.20.1

#5 lore raw

Re: [dpdk-dev] [PATCH 2/5] app/testpmd: print fractional part in CPU cycles

Quoted 53 lines · Konstantin
Quoted 50 lines

Hi Konstantin,

Quoted 46 lines · Konstantin
Quoted 35 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Dharmik Thakkar
Sent: Wednesday, May 6, 2020 10:59 PM
To: Lu, Wenzhuo <[email protected]>; Wu, Jingjing <[email protected]>; Iremonger, Bernard <[email protected]>
Cc: [email protected]; [email protected]; Dharmik Thakkar <[email protected]>
Subject: [dpdk-dev] [PATCH 2/5] app/testpmd: print fractional part in CPU cycles

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)

---
app/test-pmd/testpmd.c | 4 ++--

1 file changed, 2 insertions(+), 2 deletions(-)
app/test-pmd/testpmd.c +0 -0
index 9a8cbbd6fc7c..9444a730a153 100644

app/test-pmd/testpmd.c fwd_stats_display(void) · line 1960

Quoted 8 lines
app/test-pmd/testpmd.c +2 -2
@@ -1955,9 +1955,9 @@ 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 %lu MHz Clock\n",
-		       (unsigned int)(fwd_cycles / total_recv),
+		       (double)(fwd_cycles / (double)total_recv),

Probably safer long double - to avoid overflow.

Quoted 7 lines
Quoted 1 line

Is it possible for a ‘double' to be less than 8 bytes?

That was my initial thought - that on some 32 bit systems it could be 4B. Though it seems I was wrong, so feel free to ignore.
BTW, what for double conversion, why not just:
double)(fwd_cycles /total_recv
?

Without (double) total recv, I will always get the fractional part as .00. For the above example, with (double)(fwd_cycles / total_recv), I see 14.00 instead of 14.28

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
app/test-pmd/testpmd.c +0 -1
 		       fwd_cycles, total_recv, (uint64_t)(rte_get_tsc_hz() / CYC_PER_MHZ));
 #endif
 }
--

2.20.1

#6 lore raw

Re: [dpdk-dev] [PATCH 2/5] app/testpmd: print fractional part in CPU cycles

Quoted 66 lines

-----Original Message-----
From: Dharmik Thakkar <[email protected]>
Sent: Friday, May 8, 2020 6:37 PM
To: Ananyev, Konstantin <[email protected]>
Cc: Lu, Wenzhuo <[email protected]>; Wu, Jingjing <[email protected]>; Iremonger, Bernard <[email protected]>; [email protected]; nd <[email protected]>
Subject: Re: [dpdk-dev] [PATCH 2/5] app/testpmd: print fractional part in CPU cycles

Quoted 12 lines · Konstantin
Quoted 11 lines

Hi Konstantin,

Quoted 8 lines · Konstantin
Quoted 7 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Dharmik Thakkar
Sent: Wednesday, May 6, 2020 10:59 PM
To: Lu, Wenzhuo <[email protected]>; Wu, Jingjing <[email protected]>; Iremonger, Bernard

<[email protected]>

Quoted 41 lines
Quoted 40 lines
Quoted 23 lines
Quoted 23 lines

Cc: [email protected]; [email protected]; Dharmik Thakkar <[email protected]>
Subject: [dpdk-dev] [PATCH 2/5] app/testpmd: print fractional part in CPU cycles

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)

---
app/test-pmd/testpmd.c | 4 ++--

1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 15 lines

app/test-pmd/testpmd.c fwd_stats_display(void) · line 1960

Quoted 13 lines
app/test-pmd/testpmd.c +2 -2
index 9a8cbbd6fc7c..9444a730a153 100644
@@ -1955,9 +1955,9 @@ 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 %lu MHz Clock\n",
-		       (unsigned int)(fwd_cycles / total_recv),
+		       (double)(fwd_cycles / (double)total_recv),

Probably safer long double - to avoid overflow.

Is it possible for a ‘double' to be less than 8 bytes?

Quoted 8 lines
Quoted 5 lines

That was my initial thought - that on some 32 bit systems it could be 4B. Though it seems I was wrong, so feel free to ignore.
BTW, what for double conversion, why not just:
double)(fwd_cycles /total_recv
?

Without (double) total recv, I will always get the fractional part as .00. For the above example, with (double)(fwd_cycles / total_recv), I see 14.00 instead of 14.28

AFAIK, that's because that way you told compiler to do integer division and then convert result to double. While (double)fwd_cycles /total_recv, will tell compiler to explicitly convert fwd_cycles to double and compiler will implicitly do the same for total_recv too, and result will be double too.

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
app/test-pmd/testpmd.c +0 -1
 		       fwd_cycles, total_recv, (uint64_t)(rte_get_tsc_hz() / CYC_PER_MHZ));
 #endif
 }
--

2.20.1

#7 lore raw

PATCH 3/5 doc: add cycles per packet in testpmd user guide

In reply to Dharmik Thakkar

Update documentation for 'show fwd' testpmd runtime function to show CPU cycles/packet example.

---
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 51 +++++++++++++--------
 1 file changed, 31 insertions(+), 20 deletions(-)
doc/guides/testpmd_app_ug/testpmd_funcs.rst +31 -20
index a360ecccfd3f..2e565ccdbcd4 100644
@@ -351,26 +351,37 @@ Example for the io forwarding engine, with some packet drops on the tx side::
 
    testpmd> show fwd stats all
 
-     ------- Forward Stats for RX Port= 0/Queue= 0 -> TX Port= 1/Queue= 0 -------
-     RX-packets: 274293770      TX-packets: 274293642      TX-dropped: 128
-
-     ------- Forward Stats for RX Port= 1/Queue= 0 -> TX Port= 0/Queue= 0 -------
-     RX-packets: 274301850      TX-packets: 274301850      TX-dropped: 0
-
-     ---------------------- Forward statistics for port 0  ----------------------
-     RX-packets: 274293802      RX-dropped: 0             RX-total: 274293802
-     TX-packets: 274301862      TX-dropped: 0             TX-total: 274301862
-     ----------------------------------------------------------------------------
-
-     ---------------------- Forward statistics for port 1  ----------------------
-     RX-packets: 274301894      RX-dropped: 0             RX-total: 274301894
-     TX-packets: 274293706      TX-dropped: 128           TX-total: 274293834
-     ----------------------------------------------------------------------------
-
-     +++++++++++++++ Accumulated forward statistics for all ports+++++++++++++++
-     RX-packets: 548595696      RX-dropped: 0             RX-total: 548595696
-     TX-packets: 548595568      TX-dropped: 128           TX-total: 548595696
-     ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+     ------- Forward Stats for RX Port= 0/Queue= 0 -> TX Port= 1/Queue= 0 -------
+     RX-packets: 43536504       TX-packets: 43536488       TX-dropped: 0
+
+     ------- Forward Stats for RX Port= 1/Queue= 0 -> TX Port= 0/Queue= 0 -------
+     RX-packets: 149738504      TX-packets: 149738504      TX-dropped: 0
+
+     ------- Forward Stats for RX Port= 1/Queue= 1 -> TX Port= 0/Queue= 1 -------
+     RX-packets: 149753052      TX-packets: 149753052      TX-dropped: 0
+
+     ---------------------- Forward statistics for port 0  ----------------------
+     RX-packets: 43538881       RX-dropped: 72            RX-total: 43538953
+     TX-packets: 299491753      TX-dropped: 0             TX-total: 299491753
+     ----------------------------------------------------------------------------
+
+     ---------------------- Forward statistics for port 1  ----------------------
+     RX-packets: 299493085      RX-dropped: 8357          RX-total: 299501442
+     TX-packets: 43539683       TX-dropped: 0             TX-total: 43539683
+     ----------------------------------------------------------------------------
+
+     +++++++++++++++ Accumulated forward statistics for all ports+++++++++++++++
+     RX-packets: 343031966      RX-dropped: 8429          RX-total: 343040395
+     TX-packets: 343031436      TX-dropped: 0             TX-total: 343031436
+     ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+     CPU cycles/packet=14.28 (total cycles=4899533541 / total RX packets=343031966) at 200 MHz
+
+.. note::
+
+   Measuring CPU cycles/packet requires enabling CONFIG_RTE_TEST_PMD_RECORD_CORE_TX_CYCLES configuration option.
+   On aarch64 platforms, by default, the cycles are counted using generic counter which runs at a lower frequency than the CPU clock.
+   To get the cycles/packet at CPU clock frequency, please scale the cycles/packet to CPU clock frequency. Alternatively, use the PMU based cycle counter.
 
 clear fwd
 ~~~~~~~~~
Signature · 1 line
2.20.1
#8 lore raw

Re: [dpdk-dev] [PATCH 3/5] doc: add cycles per packet in testpmd user guide

Quoted 58 lines · Dharmik Thakkar

Update documentation for 'show fwd' testpmd runtime function to show CPU cycles/packet example.

---
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 51 +++++++++++++--------
 1 file changed, 31 insertions(+), 20 deletions(-)
doc/guides/testpmd_app_ug/testpmd_funcs.rst +19 -20
index a360ecccfd3f..2e565ccdbcd4 100644
@@ -351,26 +351,37 @@ Example for the io forwarding engine, with some packet drops on the tx side::
 
    testpmd> show fwd stats all
 
-     ------- Forward Stats for RX Port= 0/Queue= 0 -> TX Port= 1/Queue= 0 -------
-     RX-packets: 274293770      TX-packets: 274293642      TX-dropped: 128
-
-     ------- Forward Stats for RX Port= 1/Queue= 0 -> TX Port= 0/Queue= 0 -------
-     RX-packets: 274301850      TX-packets: 274301850      TX-dropped: 0
-
-     ---------------------- Forward statistics for port 0  ----------------------
-     RX-packets: 274293802      RX-dropped: 0             RX-total: 274293802
-     TX-packets: 274301862      TX-dropped: 0             TX-total: 274301862
-     ----------------------------------------------------------------------------
-
-     ---------------------- Forward statistics for port 1  ----------------------
-     RX-packets: 274301894      RX-dropped: 0             RX-total: 274301894
-     TX-packets: 274293706      TX-dropped: 128           TX-total: 274293834
-     ----------------------------------------------------------------------------
-
-     +++++++++++++++ Accumulated forward statistics for all ports+++++++++++++++
-     RX-packets: 548595696      RX-dropped: 0             RX-total: 548595696
-     TX-packets: 548595568      TX-dropped: 128           TX-total: 548595696
-     ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+     ------- Forward Stats for RX Port= 0/Queue= 0 -> TX Port= 1/Queue= 0 -------
+     RX-packets: 43536504       TX-packets: 43536488       TX-dropped: 0
+
+     ------- Forward Stats for RX Port= 1/Queue= 0 -> TX Port= 0/Queue= 0 -------
+     RX-packets: 149738504      TX-packets: 149738504      TX-dropped: 0
+
+     ------- Forward Stats for RX Port= 1/Queue= 1 -> TX Port= 0/Queue= 1 -------
+     RX-packets: 149753052      TX-packets: 149753052      TX-dropped: 0
+
+     ---------------------- Forward statistics for port 0  ----------------------
+     RX-packets: 43538881       RX-dropped: 72            RX-total: 43538953
+     TX-packets: 299491753      TX-dropped: 0             TX-total: 299491753
+     ----------------------------------------------------------------------------
+
+     ---------------------- Forward statistics for port 1  ----------------------
+     RX-packets: 299493085      RX-dropped: 8357          RX-total: 299501442
+     TX-packets: 43539683       TX-dropped: 0             TX-total: 43539683
+     ----------------------------------------------------------------------------
+

doc/guides/testpmd_app_ug/testpmd_funcs.rst Example for the io forwarding engine, with some packet drops on the tx side:: · line 382

Quoted 10 lines
doc/guides/testpmd_app_ug/testpmd_funcs.rst +10 -0
+     +++++++++++++++ Accumulated forward statistics for all ports+++++++++++++++
+     RX-packets: 343031966      RX-dropped: 8429          RX-total: 343040395
+     TX-packets: 343031436      TX-dropped: 0             TX-total: 343031436
+     ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+     CPU cycles/packet=14.28 (total cycles=4899533541 / total RX packets=343031966) at 200 MHz
+
+.. note::
+
+   Measuring CPU cycles/packet requires enabling CONFIG_RTE_TEST_PMD_RECORD_CORE_TX_CYCLES configuration option.

IMO, it a very useful feature for CI/CD and development as we don't need to see any Traffic generator to see any regression.

I think, enabling CONFIG_RTE_TEST_PMD_RECORD_CORE_TX_CYCLES configuration is overhead to use in all the environments.

How about adding a "new forward" engine with and remove CONFIG_RTE_TEST_PMD_RECORD_CORE_TX_CYCLES.
The new forward engine will have CONFIG_RTE_TEST_PMD_RECORD_CORE_TX_CYCLES code enabled. So the application can use the forward engine dynamically. aka the same build works for both cases.

Quoted 8 lines
doc/guides/testpmd_app_ug/testpmd_funcs.rst +2 -1
+   On aarch64 platforms, by default, the cycles are counted using generic counter which runs at a lower frequency than the CPU clock.
+   To get the cycles/packet at CPU clock frequency, please scale the cycles/packet to CPU clock frequency. Alternatively, use the PMU based cycle counter.
 
 clear fwd
 ~~~~~~~~~
--

2.20.1

#9 lore raw

Re: [dpdk-dev] [PATCH 3/5] doc: add cycles per packet in testpmd user guide

Hi Jerin,

Quoted 78 lines · Jerin Jacob
Quoted 58 lines · Dharmik Thakkar

Update documentation for 'show fwd' testpmd runtime function to show CPU cycles/packet example.

---
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 51 +++++++++++++--------

1 file changed, 31 insertions(+), 20 deletions(-)
doc/guides/testpmd_app_ug/testpmd_funcs.rst +19 -20
index a360ecccfd3f..2e565ccdbcd4 100644
@@ -351,26 +351,37 @@ Example for the io forwarding engine, with some packet drops on the tx side::
 
   testpmd> show fwd stats all
 
-     ------- Forward Stats for RX Port= 0/Queue= 0 -> TX Port= 1/Queue= 0 -------
-     RX-packets: 274293770      TX-packets: 274293642      TX-dropped: 128
-
-     ------- Forward Stats for RX Port= 1/Queue= 0 -> TX Port= 0/Queue= 0 -------
-     RX-packets: 274301850      TX-packets: 274301850      TX-dropped: 0
-
-     ---------------------- Forward statistics for port 0  ----------------------
-     RX-packets: 274293802      RX-dropped: 0             RX-total: 274293802
-     TX-packets: 274301862      TX-dropped: 0             TX-total: 274301862
-     ----------------------------------------------------------------------------
-
-     ---------------------- Forward statistics for port 1  ----------------------
-     RX-packets: 274301894      RX-dropped: 0             RX-total: 274301894
-     TX-packets: 274293706      TX-dropped: 128           TX-total: 274293834
-     ----------------------------------------------------------------------------
-
-     +++++++++++++++ Accumulated forward statistics for all ports+++++++++++++++
-     RX-packets: 548595696      RX-dropped: 0             RX-total: 548595696
-     TX-packets: 548595568      TX-dropped: 128           TX-total: 548595696
-     ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+     ------- Forward Stats for RX Port= 0/Queue= 0 -> TX Port= 1/Queue= 0 -------
+     RX-packets: 43536504       TX-packets: 43536488       TX-dropped: 0
+
+     ------- Forward Stats for RX Port= 1/Queue= 0 -> TX Port= 0/Queue= 0 -------
+     RX-packets: 149738504      TX-packets: 149738504      TX-dropped: 0
+
+     ------- Forward Stats for RX Port= 1/Queue= 1 -> TX Port= 0/Queue= 1 -------
+     RX-packets: 149753052      TX-packets: 149753052      TX-dropped: 0
+
+     ---------------------- Forward statistics for port 0  ----------------------
+     RX-packets: 43538881       RX-dropped: 72            RX-total: 43538953
+     TX-packets: 299491753      TX-dropped: 0             TX-total: 299491753
+     ----------------------------------------------------------------------------
+
+     ---------------------- Forward statistics for port 1  ----------------------
+     RX-packets: 299493085      RX-dropped: 8357          RX-total: 299501442
+     TX-packets: 43539683       TX-dropped: 0             TX-total: 43539683
+     ----------------------------------------------------------------------------
+

doc/guides/testpmd_app_ug/testpmd_funcs.rst Example for the io forwarding engine, with some packet drops on the tx side:: · line 382

Quoted 10 lines
doc/guides/testpmd_app_ug/testpmd_funcs.rst +10 -0
+     +++++++++++++++ Accumulated forward statistics for all ports+++++++++++++++
+     RX-packets: 343031966      RX-dropped: 8429          RX-total: 343040395
+     TX-packets: 343031436      TX-dropped: 0             TX-total: 343031436
+     ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+     CPU cycles/packet=14.28 (total cycles=4899533541 / total RX packets=343031966) at 200 MHz
+
+.. note::
+
+   Measuring CPU cycles/packet requires enabling CONFIG_RTE_TEST_PMD_RECORD_CORE_TX_CYCLES configuration option.

IMO, it a very useful feature for CI/CD and development as we don't need to see any Traffic generator to see any regression.

I think, enabling CONFIG_RTE_TEST_PMD_RECORD_CORE_TX_CYCLES configuration is overhead to use in all the environments.

Quoted 6 lines

How about adding a "new forward" engine with and remove CONFIG_RTE_TEST_PMD_RECORD_CORE_TX_CYCLES.
The new forward engine will have CONFIG_RTE_TEST_PMD_RECORD_CORE_TX_CYCLES code enabled. So the application can use the forward engine dynamically. aka the same build works for both cases.

Yes, this can be done as a separate patch.
The idea of this patch is to update the documentation with the missing CPU cycles/packet information.

Quoted 9 lines
Quoted 9 lines
doc/guides/testpmd_app_ug/testpmd_funcs.rst +2 -0
+   On aarch64 platforms, by default, the cycles are counted using generic counter which runs at a lower frequency than the CPU clock.
+   To get the cycles/packet at CPU clock frequency, please scale the cycles/packet to CPU clock frequency. Alternatively, use the PMU based cycle counter.
 

clear fwd
~~~~~~~~~
--
2.20.1

#10 lore raw

Re: [dpdk-dev] [PATCH 3/5] doc: add cycles per packet in testpmd user guide

In reply to Dharmik Thakkar

Hi Dharmik,

Quoted 103 lines

-----Original Message-----
From: Dharmik Thakkar <[email protected]>
Sent: Wednesday, May 6, 2020 10:59 PM
To: Lu, Wenzhuo <[email protected]>; Wu, Jingjing <[email protected]>; Iremonger, Bernard <[email protected]>; Mcnamara, John <[email protected]>; Kovacevic, Marko <[email protected]>
Cc: [email protected]; [email protected]; Dharmik Thakkar <[email protected]>
Subject: [PATCH 3/5] doc: add cycles per packet in testpmd user guide

Update documentation for 'show fwd' testpmd runtime function to show CPU cycles/packet example.

---
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 51 +++++++++++++------
--
 1 file changed, 31 insertions(+), 20 deletions(-)
doc/guides/testpmd_app_ug/testpmd_funcs.rst +0 -0
index a360ecccfd3f..2e565ccdbcd4 100644
@@ -351,26 +351,37 @@ Example for the io forwarding engine, with some

packet drops on the tx side::

testpmd> show fwd stats all

doc/guides/testpmd_app_ug/testpmd_funcs.rst +0 -19
-     ------- Forward Stats for RX Port= 0/Queue= 0 -> TX Port= 1/Queue= 0 -----
--
-     RX-packets: 274293770      TX-packets: 274293642      TX-dropped: 128
-
-     ------- Forward Stats for RX Port= 1/Queue= 0 -> TX Port= 0/Queue= 0 -----
--
-     RX-packets: 274301850      TX-packets: 274301850      TX-dropped: 0
-
-     ---------------------- Forward statistics for port 0  ----------------------
-     RX-packets: 274293802      RX-dropped: 0             RX-total: 274293802
-     TX-packets: 274301862      TX-dropped: 0             TX-total: 274301862
-     ----------------------------------------------------------------------------
-
-     ---------------------- Forward statistics for port 1  ----------------------
-     RX-packets: 274301894      RX-dropped: 0             RX-total: 274301894
-     TX-packets: 274293706      TX-dropped: 128           TX-total: 274293834
-     ----------------------------------------------------------------------------
-
-     +++++++++++++++ Accumulated forward statistics for all

ports+++++++++++++++

doc/guides/testpmd_app_ug/testpmd_funcs.rst +29 -6
-     RX-packets: 548595696      RX-dropped: 0             RX-total: 548595696
-     TX-packets: 548595568      TX-dropped: 128           TX-total: 548595696
-
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++
+     ------- Forward Stats for RX Port= 0/Queue= 0 -> TX Port= 1/Queue= 0 ----
---
+     RX-packets: 43536504       TX-packets: 43536488       TX-dropped:
+ 0
+
+     ------- Forward Stats for RX Port= 1/Queue= 0 -> TX Port= 0/Queue= 0 ----
---
+     RX-packets: 149738504      TX-packets: 149738504      TX-dropped:
+ 0
+
+     ------- Forward Stats for RX Port= 1/Queue= 1 -> TX Port= 0/Queue= 1 ----
---
+     RX-packets: 149753052      TX-packets: 149753052      TX-dropped:
+ 0
+
+     ---------------------- Forward statistics for port 0  ----------------------
+     RX-packets: 43538881       RX-dropped: 72            RX-total: 43538953
+     TX-packets: 299491753      TX-dropped: 0             TX-total: 299491753
+
+ ----------------------------------------------------------------------
+ ------
+
+     ---------------------- Forward statistics for port 1  ----------------------
+     RX-packets: 299493085      RX-dropped: 8357          RX-total: 299501442
+     TX-packets: 43539683       TX-dropped: 0             TX-total: 43539683
+
+ ----------------------------------------------------------------------
+ ------
+
+     +++++++++++++++ Accumulated forward statistics for all

ports+++++++++++++++

doc/guides/testpmd_app_ug/testpmd_funcs.rst +14 -0
+     RX-packets: 343031966      RX-dropped: 8429          RX-total: 343040395
+     TX-packets: 343031436      TX-dropped: 0             TX-total: 343031436
+
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++
+ ++++++
+
+     CPU cycles/packet=14.28 (total cycles=4899533541 / total RX
+ packets=343031966) at 200 MHz
+
+.. note::
+
+   Measuring CPU cycles/packet requires enabling
Quoted 6 lines

CONFIG_RTE_TEST_PMD_RECORD_CORE_TX_CYCLES configuration option.
+ On aarch64 platforms, by default, the cycles are counted using generic
counter which runs at a lower frequency than the CPU clock.
+ To get the cycles/packet at CPU clock frequency, please scale the
cycles/packet to CPU clock frequency. Alternatively, use the PMU based cycle counter.

It is preferred to use shorter lines in .rst file, preferably <= 80, up to 100 is acceptable.

Quoted 5 lines

clear fwd
~~~~~~~~~
--
2.20.1

Regards,

Bernard.

#11 lore raw

PATCH 4/5 doc: include config options in testpmd user guide

In reply to Dharmik Thakkar

Update testpmd documentation to include RECORD configuration options, CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES and CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS.

---
 doc/guides/testpmd_app_ug/build_app.rst | 12 ++++++++++++
 1 file changed, 12 insertions(+)
doc/guides/testpmd_app_ug/build_app.rst +12 -0
index d1ca9f3d19a9..caebb33849e3 100644
@@ -21,6 +21,18 @@ The basic compilation steps are:
 
         export RTE_TARGET=x86_64-native-linux-gcc
 
+##.  If required, enable configuration options. For example:
+
+    .. code-block:: console
+
+        cd to the top-level DPDK directory
+        sed -i 's,\(CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES\)=n,\1=y,' config/common_base
+        sed -i 's,\(CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS\)=n,\1=y,' config/common_base
+
+    Enabling CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES enables measurement of CPU cycles.
+
+    Enabling CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS enables display of RX and TX bursts.
+
 #.  Build the application:
 
     .. code-block:: console
Signature · 1 line
2.20.1
#12 lore raw

Re: [dpdk-dev] [PATCH 4/5] doc: include config options in testpmd user guide

Hi Dharmik,

Quoted 29 lines

-----Original Message-----
From: Dharmik Thakkar <[email protected]>
Sent: Wednesday, May 6, 2020 10:59 PM
To: Lu, Wenzhuo <[email protected]>; Wu, Jingjing <[email protected]>; Iremonger, Bernard <[email protected]>; Mcnamara, John <[email protected]>; Kovacevic, Marko <[email protected]>
Cc: [email protected]; [email protected]; Dharmik Thakkar <[email protected]>
Subject: [PATCH 4/5] doc: include config options in testpmd user guide

Update testpmd documentation to include RECORD configuration options, CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES and CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS.

---
 doc/guides/testpmd_app_ug/build_app.rst | 12 ++++++++++++
 1 file changed, 12 insertions(+)
doc/guides/testpmd_app_ug/build_app.rst +0 -0
index d1ca9f3d19a9..caebb33849e3 100644

doc/guides/testpmd_app_ug/build_app.rst The basic compilation steps are: · line 24

Quoted 4 lines
doc/guides/testpmd_app_ug/build_app.rst +1 -0
@@ -21,6 +21,18 @@ The basic compilation steps are:
 
         export RTE_TARGET=x86_64-native-linux-gcc
 
+##.  If required, enable configuration options. For example:

##. Should be #.

Quoted 17 lines
doc/guides/testpmd_app_ug/build_app.rst +5 -0
+
+    .. code-block:: console
+
+        cd to the top-level DPDK directory
+        sed -i 's,\(CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES\)=n,\1=y,'

config/common_base

doc/guides/testpmd_app_ug/build_app.rst +4 -0
+        sed -i 's,\(CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS\)=n,\1=y,'
+ config/common_base
+
+    Enabling CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES enables

measurement of CPU cycles.

doc/guides/testpmd_app_ug/build_app.rst +2 -0
+
+    Enabling CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS enables

display of RX and TX bursts.
+
#. Build the application:

Quoted 3 lines

.. code-block:: console
--
2.20.1

Regards,

Bernard.

#13 lore raw

PATCH 5/5 doc: add aarch64 generic counter section

In reply to Dharmik Thakkar

Add a separate section for low-resolution generic counter for ARM64 profiling methods.

---
 doc/guides/prog_guide/profile_app.rst | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
doc/guides/prog_guide/profile_app.rst +8 -3
index a36ebef4db99..e5d0e9079e11 100644
@@ -57,11 +57,16 @@ For more derails refer to the
 `ARM64 specific PMU events enumeration <http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.100095_0002_04_en/way1382543438508.html>`_.
 
 
-High-resolution cycle counter
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Low-resolution generic counter
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 The default ``cntvct_el0`` based ``rte_rdtsc()`` provides a portable means to
-get a wall clock counter in user space. Typically it runs at <= 100MHz.
+get a wall clock counter in user space. Typically it runs at a lower clock frequency than the CPU clock frequency.
+Cycles counted using this method should be scaled to CPU clock frequency.
+
+
+High-resolution cycle counter
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 The alternative method to enable ``rte_rdtsc()`` for a high resolution wall
 clock counter is through the ARMv8 PMU subsystem. The PMU cycle counter runs
Signature · 1 line
2.20.1
Acked-by on v1 5/5
#14 lore raw

Re: [dpdk-dev] [PATCH 5/5] doc: add aarch64 generic counter section

Quoted 7 lines · Dharmik Thakkar

Add a separate section for low-resolution generic counter for ARM64 profiling methods.

Quoted 31 lines
---
 doc/guides/prog_guide/profile_app.rst | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
doc/guides/prog_guide/profile_app.rst +8 -4
index a36ebef4db99..e5d0e9079e11 100644
@@ -57,11 +57,16 @@ For more derails refer to the
 `ARM64 specific PMU events enumeration <http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.100095_0002_04_en/way1382543438508.html>`_.
 
 
-High-resolution cycle counter
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Low-resolution generic counter
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 The default ``cntvct_el0`` based ``rte_rdtsc()`` provides a portable means to
-get a wall clock counter in user space. Typically it runs at <= 100MHz.
+get a wall clock counter in user space. Typically it runs at a lower clock frequency than the CPU clock frequency.
+Cycles counted using this method should be scaled to CPU clock frequency.
+
+
+High-resolution cycle counter
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 The alternative method to enable ``rte_rdtsc()`` for a high resolution wall
 clock counter is through the ARMv8 PMU subsystem. The PMU cycle counter runs
--

2.20.1

#15 lore raw
In reply to Dharmik Thakkar

W dniu 06.05.2020 o 23:58, Dharmik Thakkar pisze:

Quoted 17 lines

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.

---
  app/test-pmd/testpmd.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
app/test-pmd/testpmd.c +0 -0
index 99bacddbfdca..9a8cbbd6fc7c 100644

app/test-pmd/testpmd.c fwd_stats_display(void) · line 1959

Quoted 8 lines
app/test-pmd/testpmd.c +2 -1
@@ -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.

Quoted 6 lines
app/test-pmd/testpmd.c +1 -1
  		       (unsigned int)(fwd_cycles / total_recv),
-		       fwd_cycles, total_recv);
+		       fwd_cycles, total_recv, (uint64_t)(rte_get_tsc_hz() / CYC_PER_MHZ));
  #endif
  }
 
Signature · 7 lines
Lukasz Wojciechowski
Principal Software Engineer

Samsung R&D Institute Poland
Samsung Electronics
Office +48 22 377 88 25
[email protected]
#16 lore raw
In reply to Dharmik Thakkar

Hi Dharmik,

Quoted 35 lines

-----Original Message-----
From: Dharmik Thakkar <[email protected]>
Sent: Wednesday, May 6, 2020 10:59 PM
To: Lu, Wenzhuo <[email protected]>; Wu, Jingjing <[email protected]>; Iremonger, Bernard <[email protected]>
Cc: [email protected]; [email protected]; Dharmik Thakkar <[email protected]>
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.

---
 app/test-pmd/testpmd.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
app/test-pmd/testpmd.c index renamed from app/test-pmd/testpmd.c +0 -0

99bacddbfdca..9a8cbbd6fc7c 100644

app/test-pmd/testpmd.c +0 -0
@@ -1953,11 +1953,12 @@ fwd_stats_display(void)
 	       "%s\n",
 	       acc_stats_border, acc_stats_border);  #ifdef

RTE_TEST_PMD_RECORD_CORE_CYCLES

app/test-pmd/testpmd.c +2 -1
+#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
Quoted 1 line

Clock\n",

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

Quoted 9 lines
app/test-pmd/testpmd.c +2 -2
 		       (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.

#17 lore raw

PATCH v2 1/5 app/testpmd: print clock with CPU cycles per pkt

In reply to Dharmik Thakkar

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.

---
v2:
- Use %"PRIu64" instead of %lu
- Fix checkpatch warning

---
 app/test-pmd/testpmd.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
app/test-pmd/testpmd.c +5 -2
index 99bacddbfdca..806abb805879 100644
@@ -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
 }
 
Signature · 1 line
2.20.1
#18 lore raw

PATCH v2 2/5 app/testpmd: print fractional part in CPU cycles

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)

---
v2:
- Change typecast to (double) fwd_cycles / total_recv

---
 app/test-pmd/testpmd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
app/test-pmd/testpmd.c +2 -2
index 806abb805879..a7ac6c66ce1c 100644
@@ -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
Signature · 1 line
2.20.1
Acked-by on v2 2/5
#19 lore raw

Re: [dpdk-dev] [PATCH v2 2/5] app/testpmd: print fractional part in CPU cycles

Quoted 19 lines

-----Original Message-----
From: Dharmik Thakkar <[email protected]>
Sent: Friday, May 8, 2020 11:38 PM
To: Lu, Wenzhuo <[email protected]>; Wu, Jingjing <[email protected]>; Iremonger, Bernard <[email protected]>
Cc: [email protected]; [email protected]; Dharmik Thakkar <[email protected]>
Subject: [PATCH v2 2/5] app/testpmd: print fractional part in CPU cycles

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)

Quoted 7 lines

With patch:
CPU cycles/packet=14.28
(total cycles=4899533541 / total RX packets=343031966)

#20 lore raw

PATCH v2 3/5 doc: add cycles per packet in testpmd user guide

In reply to Dharmik Thakkar

Update documentation for 'show fwd' testpmd runtime function to show CPU cycles/packet example.

---
v2:
- Use shorter lines, up to 100.

---
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 53 +++++++++++++--------
 1 file changed, 33 insertions(+), 20 deletions(-)
doc/guides/testpmd_app_ug/testpmd_funcs.rst +33 -20
index a360ecccfd3f..441ed41e3803 100644
@@ -351,26 +351,39 @@ Example for the io forwarding engine, with some packet drops on the tx side::
 
    testpmd> show fwd stats all
 
-     ------- Forward Stats for RX Port= 0/Queue= 0 -> TX Port= 1/Queue= 0 -------
-     RX-packets: 274293770      TX-packets: 274293642      TX-dropped: 128
-
-     ------- Forward Stats for RX Port= 1/Queue= 0 -> TX Port= 0/Queue= 0 -------
-     RX-packets: 274301850      TX-packets: 274301850      TX-dropped: 0
-
-     ---------------------- Forward statistics for port 0  ----------------------
-     RX-packets: 274293802      RX-dropped: 0             RX-total: 274293802
-     TX-packets: 274301862      TX-dropped: 0             TX-total: 274301862
-     ----------------------------------------------------------------------------
-
-     ---------------------- Forward statistics for port 1  ----------------------
-     RX-packets: 274301894      RX-dropped: 0             RX-total: 274301894
-     TX-packets: 274293706      TX-dropped: 128           TX-total: 274293834
-     ----------------------------------------------------------------------------
-
-     +++++++++++++++ Accumulated forward statistics for all ports+++++++++++++++
-     RX-packets: 548595696      RX-dropped: 0             RX-total: 548595696
-     TX-packets: 548595568      TX-dropped: 128           TX-total: 548595696
-     ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+     ------- Forward Stats for RX Port= 0/Queue= 0 -> TX Port= 1/Queue= 0 -------
+     RX-packets: 43536504       TX-packets: 43536488       TX-dropped: 0
+
+     ------- Forward Stats for RX Port= 1/Queue= 0 -> TX Port= 0/Queue= 0 -------
+     RX-packets: 149738504      TX-packets: 149738504      TX-dropped: 0
+
+     ------- Forward Stats for RX Port= 1/Queue= 1 -> TX Port= 0/Queue= 1 -------
+     RX-packets: 149753052      TX-packets: 149753052      TX-dropped: 0
+
+     ---------------------- Forward statistics for port 0  ----------------------
+     RX-packets: 43538881       RX-dropped: 72            RX-total: 43538953
+     TX-packets: 299491753      TX-dropped: 0             TX-total: 299491753
+     ----------------------------------------------------------------------------
+
+     ---------------------- Forward statistics for port 1  ----------------------
+     RX-packets: 299493085      RX-dropped: 8357          RX-total: 299501442
+     TX-packets: 43539683       TX-dropped: 0             TX-total: 43539683
+     ----------------------------------------------------------------------------
+
+     +++++++++++++++ Accumulated forward statistics for all ports+++++++++++++++
+     RX-packets: 343031966      RX-dropped: 8429          RX-total: 343040395
+     TX-packets: 343031436      TX-dropped: 0             TX-total: 343031436
+     ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+     CPU cycles/packet=14.28 (total cycles=4899533541 / total RX packets=343031966) at 200 MHz Clock
+
+.. note::
+
+   Measuring CPU cycles/packet requires enabling CONFIG_RTE_TEST_PMD_RECORD_CORE_TX_CYCLES
+   configuration option. On aarch64 platforms, by default, the cycles are counted using
+   generic counter which runs at a lower frequency than the CPU clock. To get the cycles/packet
+   at CPU clock frequency, please scale the cycles/packet to CPU clock frequency.
+   Alternatively, use the PMU based cycle counter.
 
 clear fwd
 ~~~~~~~~~
Signature · 1 line
2.20.1
Acked-by on v2 3/5
#21 lore raw

Re: [dpdk-dev] [PATCH v2 3/5] doc: add cycles per packet in testpmd user guide

Quoted 12 lines

-----Original Message-----
From: Dharmik Thakkar <[email protected]>
Sent: Friday, May 8, 2020 11:38 PM
To: Lu, Wenzhuo <[email protected]>; Wu, Jingjing <[email protected]>; Iremonger, Bernard <[email protected]>; Mcnamara, John <[email protected]>; Kovacevic, Marko <[email protected]>
Cc: [email protected]; [email protected]; Dharmik Thakkar <[email protected]>
Subject: [PATCH v2 3/5] doc: add cycles per packet in testpmd user guide

Quoted 6 lines

Update documentation for 'show fwd' testpmd runtime function to show CPU cycles/packet example.

#22 lore raw

Re: [dpdk-dev] [PATCH v2 3/5] doc: add cycles per packet in testpmd user guide

In reply to Dharmik Thakkar
Quoted 56 lines · Dharmik Thakkar

Update documentation for 'show fwd' testpmd runtime function to show CPU cycles/packet example.

---
v2:
- Use shorter lines, up to 100.

---
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 53 +++++++++++++--------
 1 file changed, 33 insertions(+), 20 deletions(-)
doc/guides/testpmd_app_ug/testpmd_funcs.rst +15 -20
index a360ecccfd3f..441ed41e3803 100644
@@ -351,26 +351,39 @@ Example for the io forwarding engine, with some packet drops on the tx side::
 
    testpmd> show fwd stats all
 
-     ------- Forward Stats for RX Port= 0/Queue= 0 -> TX Port= 1/Queue= 0 -------
-     RX-packets: 274293770      TX-packets: 274293642      TX-dropped: 128
-
-     ------- Forward Stats for RX Port= 1/Queue= 0 -> TX Port= 0/Queue= 0 -------
-     RX-packets: 274301850      TX-packets: 274301850      TX-dropped: 0
-
-     ---------------------- Forward statistics for port 0  ----------------------
-     RX-packets: 274293802      RX-dropped: 0             RX-total: 274293802
-     TX-packets: 274301862      TX-dropped: 0             TX-total: 274301862
-     ----------------------------------------------------------------------------
-
-     ---------------------- Forward statistics for port 1  ----------------------
-     RX-packets: 274301894      RX-dropped: 0             RX-total: 274301894
-     TX-packets: 274293706      TX-dropped: 128           TX-total: 274293834
-     ----------------------------------------------------------------------------
-
-     +++++++++++++++ Accumulated forward statistics for all ports+++++++++++++++
-     RX-packets: 548595696      RX-dropped: 0             RX-total: 548595696
-     TX-packets: 548595568      TX-dropped: 128           TX-total: 548595696
-     ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+     ------- Forward Stats for RX Port= 0/Queue= 0 -> TX Port= 1/Queue= 0 -------
+     RX-packets: 43536504       TX-packets: 43536488       TX-dropped: 0
+
+     ------- Forward Stats for RX Port= 1/Queue= 0 -> TX Port= 0/Queue= 0 -------
+     RX-packets: 149738504      TX-packets: 149738504      TX-dropped: 0
+
+     ------- Forward Stats for RX Port= 1/Queue= 1 -> TX Port= 0/Queue= 1 -------
+     RX-packets: 149753052      TX-packets: 149753052      TX-dropped: 0
+
+     ---------------------- Forward statistics for port 0  ----------------------
+     RX-packets: 43538881       RX-dropped: 72            RX-total: 43538953
+     TX-packets: 299491753      TX-dropped: 0             TX-total: 299491753
+     ----------------------------------------------------------------------------
+
+     ---------------------- Forward statistics for port 1  ----------------------

doc/guides/testpmd_app_ug/testpmd_funcs.rst Example for the io forwarding engine, with some packet drops on the tx side:: · line 378

Quoted 10 lines
doc/guides/testpmd_app_ug/testpmd_funcs.rst +10 -0
+     RX-packets: 299493085      RX-dropped: 8357          RX-total: 299501442
+     TX-packets: 43539683       TX-dropped: 0             TX-total: 43539683
+     ----------------------------------------------------------------------------
+
+     +++++++++++++++ Accumulated forward statistics for all ports+++++++++++++++
+     RX-packets: 343031966      RX-dropped: 8429          RX-total: 343040395
+     TX-packets: 343031436      TX-dropped: 0             TX-total: 343031436
+     ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+     CPU cycles/packet=14.28 (total cycles=4899533541 / total RX packets=343031966) at 200 MHz Clock

Hi Dharmik,

Overall it is OK to show "CPU cycles/packet", but my concern is numbers can be misleading, because for example the numbers I am getting is like below:

CPU cycles/packet=4.38 (total cycles=32871036274 / total RX packets=7511734336) at 2100 MHz Clock

doc/guides/testpmd_app_ug/testpmd_funcs.rst Example for the io forwarding engine, with some packet drops on the tx side:: · line 382

Quoted 4 lines
doc/guides/testpmd_app_ug/testpmd_funcs.rst +4 -0
+
+.. note::
+
+   Measuring CPU cycles/packet requires enabling CONFIG_RTE_TEST_PMD_RECORD_CORE_TX_CYCLES

s/TX_CYCLES/CYCLES

doc/guides/testpmd_app_ug/testpmd_funcs.rst Example for the io forwarding engine, with some packet drops on the tx side:: · line 386

Quoted 4 lines
doc/guides/testpmd_app_ug/testpmd_funcs.rst +4 -0
+   configuration option. On aarch64 platforms, by default, the cycles are counted using
+   generic counter which runs at a lower frequency than the CPU clock. To get the cycles/packet
+   at CPU clock frequency, please scale the cycles/packet to CPU clock frequency.
+   Alternatively, use the PMU based cycle counter.

Not sure the "aarch64 platforms" note suits to here, where documents the command. And I can see the platform documentation already updated for this.

Combining above two comments, what do you think instead of replacing existing stats, add a note saying enabling 'CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES' appends "CPU cycles/packet" and give above two samples, like:

"
Enabling RTE_TEST_PMD_RECORD_CORE_CYCLES appends "CPU cycles/packet" stats, like:

CPU cycles/packet=4.38 (total cycles=32871036274 / total RX packets=7511734336) at 2100 MHz Clock
OR
CPU cycles/packet=14.28 (total cycles=4899533541 / total RX packets=343031966) at 200 MHz Clock
"

#23 lore raw

Re: [dpdk-dev] [PATCH v2 3/5] doc: add cycles per packet in testpmd user guide

Hi Ferruh,

Quoted 72 lines · Ferruh Yigit
Quoted 56 lines · Dharmik Thakkar

Update documentation for 'show fwd' testpmd runtime function to show CPU cycles/packet example.

---
v2:
- Use shorter lines, up to 100.
---
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 53 +++++++++++++--------

1 file changed, 33 insertions(+), 20 deletions(-)
doc/guides/testpmd_app_ug/testpmd_funcs.rst +15 -20
index a360ecccfd3f..441ed41e3803 100644
@@ -351,26 +351,39 @@ Example for the io forwarding engine, with some packet drops on the tx side::
 
   testpmd> show fwd stats all
 
-     ------- Forward Stats for RX Port= 0/Queue= 0 -> TX Port= 1/Queue= 0 -------
-     RX-packets: 274293770      TX-packets: 274293642      TX-dropped: 128
-
-     ------- Forward Stats for RX Port= 1/Queue= 0 -> TX Port= 0/Queue= 0 -------
-     RX-packets: 274301850      TX-packets: 274301850      TX-dropped: 0
-
-     ---------------------- Forward statistics for port 0  ----------------------
-     RX-packets: 274293802      RX-dropped: 0             RX-total: 274293802
-     TX-packets: 274301862      TX-dropped: 0             TX-total: 274301862
-     ----------------------------------------------------------------------------
-
-     ---------------------- Forward statistics for port 1  ----------------------
-     RX-packets: 274301894      RX-dropped: 0             RX-total: 274301894
-     TX-packets: 274293706      TX-dropped: 128           TX-total: 274293834
-     ----------------------------------------------------------------------------
-
-     +++++++++++++++ Accumulated forward statistics for all ports+++++++++++++++
-     RX-packets: 548595696      RX-dropped: 0             RX-total: 548595696
-     TX-packets: 548595568      TX-dropped: 128           TX-total: 548595696
-     ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+     ------- Forward Stats for RX Port= 0/Queue= 0 -> TX Port= 1/Queue= 0 -------
+     RX-packets: 43536504       TX-packets: 43536488       TX-dropped: 0
+
+     ------- Forward Stats for RX Port= 1/Queue= 0 -> TX Port= 0/Queue= 0 -------
+     RX-packets: 149738504      TX-packets: 149738504      TX-dropped: 0
+
+     ------- Forward Stats for RX Port= 1/Queue= 1 -> TX Port= 0/Queue= 1 -------
+     RX-packets: 149753052      TX-packets: 149753052      TX-dropped: 0
+
+     ---------------------- Forward statistics for port 0  ----------------------
+     RX-packets: 43538881       RX-dropped: 72            RX-total: 43538953
+     TX-packets: 299491753      TX-dropped: 0             TX-total: 299491753
+     ----------------------------------------------------------------------------
+
+     ---------------------- Forward statistics for port 1  ----------------------

doc/guides/testpmd_app_ug/testpmd_funcs.rst Example for the io forwarding engine, with some packet drops on the tx side:: · line 378

Quoted 10 lines
doc/guides/testpmd_app_ug/testpmd_funcs.rst +10 -0
+     RX-packets: 299493085      RX-dropped: 8357          RX-total: 299501442
+     TX-packets: 43539683       TX-dropped: 0             TX-total: 43539683
+     ----------------------------------------------------------------------------
+
+     +++++++++++++++ Accumulated forward statistics for all ports+++++++++++++++
+     RX-packets: 343031966      RX-dropped: 8429          RX-total: 343040395
+     TX-packets: 343031436      TX-dropped: 0             TX-total: 343031436
+     ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+     CPU cycles/packet=14.28 (total cycles=4899533541 / total RX packets=343031966) at 200 MHz Clock

Hi Dharmik,

Quoted 5 lines

Overall it is OK to show "CPU cycles/packet", but my concern is numbers can be misleading, because for example the numbers I am getting is like below:

CPU cycles/packet=4.38 (total cycles=32871036274 / total RX packets=7511734336) at 2100 MHz Clock

CPU cycles/packet shown above is a part of the example. The numbers are as per the statistics shown in the example.

Quoted 7 lines

doc/guides/testpmd_app_ug/testpmd_funcs.rst Example for the io forwarding engine, with some packet drops on the tx side:: · line 382

Quoted 5 lines
doc/guides/testpmd_app_ug/testpmd_funcs.rst +4 -0
+
+.. note::
+
+   Measuring CPU cycles/packet requires enabling CONFIG_RTE_TEST_PMD_RECORD_CORE_TX_CYCLES

s/TX_CYCLES/CYCLES

Sorry, didn’t understand this comment.

Quoted 8 lines

doc/guides/testpmd_app_ug/testpmd_funcs.rst Example for the io forwarding engine, with some packet drops on the tx side:: · line 386

Quoted 5 lines
doc/guides/testpmd_app_ug/testpmd_funcs.rst +4 -0
+   configuration option. On aarch64 platforms, by default, the cycles are counted using
+   generic counter which runs at a lower frequency than the CPU clock. To get the cycles/packet
+   at CPU clock frequency, please scale the cycles/packet to CPU clock frequency.
+   Alternatively, use the PMU based cycle counter.

Not sure the "aarch64 platforms" note suits to here, where documents the command. And I can see the platform documentation already updated for this.

This additional comment about aarch64 platforms is to provide complete information to the users with regards to the config option and offer a better understanding of the CPU cycles/packet numbers. IMO, without this note, CPU cycles/packet numbers can be misleading.

Quoted 8 lines

Combining above two comments, what do you think instead of replacing existing stats, add a note saying enabling 'CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES' appends "CPU cycles/packet" and give above two samples, like:

"
Enabling RTE_TEST_PMD_RECORD_CORE_CYCLES appends "CPU cycles/packet" stats, like:

Quoted 6 lines

CPU cycles/packet=4.38 (total cycles=32871036274 / total RX packets=7511734336) at 2100 MHz Clock
OR
CPU cycles/packet=14.28 (total cycles=4899533541 / total RX packets=343031966) at 200 MHz Clock
"

Yes, this is also an option. IMO, numbers shown within CPU cycles/packet example should be consistent with the forward statistics numbers.

#24 lore raw

Re: [dpdk-dev] [PATCH v2 3/5] doc: add cycles per packet in testpmd user guide

Quoted 74 lines · Dharmik Thakkar

Hi Ferruh,

Quoted 72 lines · Ferruh Yigit
Quoted 56 lines · Dharmik Thakkar

Update documentation for 'show fwd' testpmd runtime function to show CPU cycles/packet example.

---
v2:
- Use shorter lines, up to 100.
---
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 53 +++++++++++++--------

1 file changed, 33 insertions(+), 20 deletions(-)
doc/guides/testpmd_app_ug/testpmd_funcs.rst +15 -20
index a360ecccfd3f..441ed41e3803 100644
@@ -351,26 +351,39 @@ Example for the io forwarding engine, with some packet drops on the tx side::
 
   testpmd> show fwd stats all
 
-     ------- Forward Stats for RX Port= 0/Queue= 0 -> TX Port= 1/Queue= 0 -------
-     RX-packets: 274293770      TX-packets: 274293642      TX-dropped: 128
-
-     ------- Forward Stats for RX Port= 1/Queue= 0 -> TX Port= 0/Queue= 0 -------
-     RX-packets: 274301850      TX-packets: 274301850      TX-dropped: 0
-
-     ---------------------- Forward statistics for port 0  ----------------------
-     RX-packets: 274293802      RX-dropped: 0             RX-total: 274293802
-     TX-packets: 274301862      TX-dropped: 0             TX-total: 274301862
-     ----------------------------------------------------------------------------
-
-     ---------------------- Forward statistics for port 1  ----------------------
-     RX-packets: 274301894      RX-dropped: 0             RX-total: 274301894
-     TX-packets: 274293706      TX-dropped: 128           TX-total: 274293834
-     ----------------------------------------------------------------------------
-
-     +++++++++++++++ Accumulated forward statistics for all ports+++++++++++++++
-     RX-packets: 548595696      RX-dropped: 0             RX-total: 548595696
-     TX-packets: 548595568      TX-dropped: 128           TX-total: 548595696
-     ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+     ------- Forward Stats for RX Port= 0/Queue= 0 -> TX Port= 1/Queue= 0 -------
+     RX-packets: 43536504       TX-packets: 43536488       TX-dropped: 0
+
+     ------- Forward Stats for RX Port= 1/Queue= 0 -> TX Port= 0/Queue= 0 -------
+     RX-packets: 149738504      TX-packets: 149738504      TX-dropped: 0
+
+     ------- Forward Stats for RX Port= 1/Queue= 1 -> TX Port= 0/Queue= 1 -------
+     RX-packets: 149753052      TX-packets: 149753052      TX-dropped: 0
+
+     ---------------------- Forward statistics for port 0  ----------------------
+     RX-packets: 43538881       RX-dropped: 72            RX-total: 43538953
+     TX-packets: 299491753      TX-dropped: 0             TX-total: 299491753
+     ----------------------------------------------------------------------------
+
+     ---------------------- Forward statistics for port 1  ----------------------

doc/guides/testpmd_app_ug/testpmd_funcs.rst Example for the io forwarding engine, with some packet drops on the tx side:: · line 378

Quoted 10 lines
doc/guides/testpmd_app_ug/testpmd_funcs.rst +10 -0
+     RX-packets: 299493085      RX-dropped: 8357          RX-total: 299501442
+     TX-packets: 43539683       TX-dropped: 0             TX-total: 43539683
+     ----------------------------------------------------------------------------
+
+     +++++++++++++++ Accumulated forward statistics for all ports+++++++++++++++
+     RX-packets: 343031966      RX-dropped: 8429          RX-total: 343040395
+     TX-packets: 343031436      TX-dropped: 0             TX-total: 343031436
+     ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+     CPU cycles/packet=14.28 (total cycles=4899533541 / total RX packets=343031966) at 200 MHz Clock

Hi Dharmik,

Quoted 7 lines
Quoted 5 lines

Overall it is OK to show "CPU cycles/packet", but my concern is numbers can be misleading, because for example the numbers I am getting is like below:

CPU cycles/packet=4.38 (total cycles=32871036274 / total RX packets=7511734336) at 2100 MHz Clock

CPU cycles/packet shown above is a part of the example. The numbers are as per the statistics shown in the example.

I know but now you are showing a performance number and it is specific to a platform, my concern it may be misleading and create false expectations for others.

Quoted 10 lines
Quoted 8 lines

doc/guides/testpmd_app_ug/testpmd_funcs.rst Example for the io forwarding engine, with some packet drops on the tx side:: · line 382

Quoted 6 lines
doc/guides/testpmd_app_ug/testpmd_funcs.rst +4 -0
+
+.. note::
+
+   Measuring CPU cycles/packet requires enabling CONFIG_RTE_TEST_PMD_RECORD_CORE_TX_CYCLES

s/TX_CYCLES/CYCLES

Sorry, didn’t understand this comment.

There is no 'CONFIG_RTE_TEST_PMD_RECORD_CORE_TX_CYCLES' config option.

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
doc/guides/testpmd_app_ug/testpmd_funcs.rst +4 -0
+   configuration option. On aarch64 platforms, by default, the cycles are counted using
+   generic counter which runs at a lower frequency than the CPU clock. To get the cycles/packet
+   at CPU clock frequency, please scale the cycles/packet to CPU clock frequency.
+   Alternatively, use the PMU based cycle counter.
Quoted 5 lines
Quoted 2 lines

Not sure the "aarch64 platforms" note suits to here, where documents the command. And I can see the platform documentation already updated for this.

This additional comment about aarch64 platforms is to provide complete information to the users with regards to the config option and offer a better understanding of the CPU cycles/packet numbers. IMO, without this note, CPU cycles/packet numbers can be misleading.

This is testpmd documentation to describe "show fwd stats" command. We are adding a note to say with a config option it may also show performance data, which is OK. But starting to describe the platform differences for this config option looks to much details for the scope of the document. For testpmd I would prefer command usage independent from platforms, otherwise the documentation may become too confusing/complex.
But agree to provide the information for the specific platform, which you are already doing in other patch in the platform documentation.

Quoted 9 lines
Quoted 9 lines

Combining above two comments, what do you think instead of replacing existing stats, add a note saying enabling 'CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES' appends "CPU cycles/packet" and give above two samples, like:

"
Enabling RTE_TEST_PMD_RECORD_CORE_CYCLES appends "CPU cycles/packet" stats, like:

Quoted 9 lines
Quoted 6 lines

CPU cycles/packet=4.38 (total cycles=32871036274 / total RX packets=7511734336) at 2100 MHz Clock
OR
CPU cycles/packet=14.28 (total cycles=4899533541 / total RX packets=343031966) at 200 MHz Clock
"

Yes, this is also an option. IMO, numbers shown within CPU cycles/packet example should be consistent with the forward statistics numbers.

This part is just the sample of the "CPU cycles/packet" output, I think it provides enough context to be understandable without matching Rx packet count in above part of the stats.

#25 lore raw

Re: [dpdk-dev] [PATCH v2 3/5] doc: add cycles per packet in testpmd user guide

Quoted 82 lines · Ferruh Yigit
Quoted 77 lines · Dharmik Thakkar

Hi Ferruh,

Quoted 75 lines · Ferruh Yigit
Quoted 56 lines · Dharmik Thakkar

Update documentation for 'show fwd' testpmd runtime function to show CPU cycles/packet example.

---
v2:
- Use shorter lines, up to 100.
---
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 53 +++++++++++++--------

1 file changed, 33 insertions(+), 20 deletions(-)
doc/guides/testpmd_app_ug/testpmd_funcs.rst +15 -20
index a360ecccfd3f..441ed41e3803 100644
@@ -351,26 +351,39 @@ Example for the io forwarding engine, with some packet drops on the tx side::
 
  testpmd> show fwd stats all
 
-     ------- Forward Stats for RX Port= 0/Queue= 0 -> TX Port= 1/Queue= 0 -------
-     RX-packets: 274293770      TX-packets: 274293642      TX-dropped: 128
-
-     ------- Forward Stats for RX Port= 1/Queue= 0 -> TX Port= 0/Queue= 0 -------
-     RX-packets: 274301850      TX-packets: 274301850      TX-dropped: 0
-
-     ---------------------- Forward statistics for port 0  ----------------------
-     RX-packets: 274293802      RX-dropped: 0             RX-total: 274293802
-     TX-packets: 274301862      TX-dropped: 0             TX-total: 274301862
-     ----------------------------------------------------------------------------
-
-     ---------------------- Forward statistics for port 1  ----------------------
-     RX-packets: 274301894      RX-dropped: 0             RX-total: 274301894
-     TX-packets: 274293706      TX-dropped: 128           TX-total: 274293834
-     ----------------------------------------------------------------------------
-
-     +++++++++++++++ Accumulated forward statistics for all ports+++++++++++++++
-     RX-packets: 548595696      RX-dropped: 0             RX-total: 548595696
-     TX-packets: 548595568      TX-dropped: 128           TX-total: 548595696
-     ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+     ------- Forward Stats for RX Port= 0/Queue= 0 -> TX Port= 1/Queue= 0 -------
+     RX-packets: 43536504       TX-packets: 43536488       TX-dropped: 0
+
+     ------- Forward Stats for RX Port= 1/Queue= 0 -> TX Port= 0/Queue= 0 -------
+     RX-packets: 149738504      TX-packets: 149738504      TX-dropped: 0
+
+     ------- Forward Stats for RX Port= 1/Queue= 1 -> TX Port= 0/Queue= 1 -------
+     RX-packets: 149753052      TX-packets: 149753052      TX-dropped: 0
+
+     ---------------------- Forward statistics for port 0  ----------------------
+     RX-packets: 43538881       RX-dropped: 72            RX-total: 43538953
+     TX-packets: 299491753      TX-dropped: 0             TX-total: 299491753
+     ----------------------------------------------------------------------------
+
+     ---------------------- Forward statistics for port 1  ----------------------

doc/guides/testpmd_app_ug/testpmd_funcs.rst Example for the io forwarding engine, with some packet drops on the tx side:: · line 378

Quoted 10 lines
doc/guides/testpmd_app_ug/testpmd_funcs.rst +10 -0
+     RX-packets: 299493085      RX-dropped: 8357          RX-total: 299501442
+     TX-packets: 43539683       TX-dropped: 0             TX-total: 43539683
+     ----------------------------------------------------------------------------
+
+     +++++++++++++++ Accumulated forward statistics for all ports+++++++++++++++
+     RX-packets: 343031966      RX-dropped: 8429          RX-total: 343040395
+     TX-packets: 343031436      TX-dropped: 0             TX-total: 343031436
+     ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+     CPU cycles/packet=14.28 (total cycles=4899533541 / total RX packets=343031966) at 200 MHz Clock

Hi Dharmik,

Overall it is OK to show "CPU cycles/packet", but my concern is numbers can be misleading, because for example the numbers I am getting is like below:

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

CPU cycles/packet=4.38 (total cycles=32871036274 / total RX packets=7511734336) at 2100 MHz Clock

CPU cycles/packet shown above is a part of the example. The numbers are as per the statistics shown in the example.

I know but now you are showing a performance number and it is specific to a platform, my concern it may be misleading and create false expectations for others.

Ok, makes sense.

Quoted 10 lines
Quoted 10 lines
Quoted 9 lines

doc/guides/testpmd_app_ug/testpmd_funcs.rst Example for the io forwarding engine, with some packet drops on the tx side:: · line 382

Quoted 7 lines
doc/guides/testpmd_app_ug/testpmd_funcs.rst +4 -0
+
+.. note::
+
+   Measuring CPU cycles/packet requires enabling CONFIG_RTE_TEST_PMD_RECORD_CORE_TX_CYCLES

s/TX_CYCLES/CYCLES

Quoted 3 lines
Quoted 1 line

Sorry, didn’t understand this comment.

There is no 'CONFIG_RTE_TEST_PMD_RECORD_CORE_TX_CYCLES' config option.

Got it, will update.

Quoted 14 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
doc/guides/testpmd_app_ug/testpmd_funcs.rst +4 -0
+   configuration option. On aarch64 platforms, by default, the cycles are counted using
+   generic counter which runs at a lower frequency than the CPU clock. To get the cycles/packet
+   at CPU clock frequency, please scale the cycles/packet to CPU clock frequency.
+   Alternatively, use the PMU based cycle counter.
Quoted 5 lines
Quoted 2 lines

Not sure the "aarch64 platforms" note suits to here, where documents the command. And I can see the platform documentation already updated for this.

This additional comment about aarch64 platforms is to provide complete information to the users with regards to the config option and offer a better understanding of the CPU cycles/packet numbers. IMO, without this note, CPU cycles/packet numbers can be misleading.

Quoted 8 lines

This is testpmd documentation to describe "show fwd stats" command. We are adding a note to say with a config option it may also show performance data, which is OK. But starting to describe the platform differences for this config option looks to much details for the scope of the document. For testpmd I would prefer command usage independent from platforms, otherwise the documentation may become too confusing/complex.
But agree to provide the information for the specific platform, which you are already doing in other patch in the platform documentation.

Alright, I will remove platform in the next version.

Quoted 17 lines
Quoted 17 lines
Quoted 16 lines

Combining above two comments, what do you think instead of replacing existing stats, add a note saying enabling 'CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES' appends "CPU cycles/packet" and give above two samples, like:

"
Enabling RTE_TEST_PMD_RECORD_CORE_CYCLES appends "CPU cycles/packet" stats, like:

CPU cycles/packet=4.38 (total cycles=32871036274 / total RX packets=7511734336) at 2100 MHz Clock
OR
CPU cycles/packet=14.28 (total cycles=4899533541 / total RX packets=343031966) at 200 MHz Clock
"

Quoted 6 lines
Quoted 2 lines

Yes, this is also an option. IMO, numbers shown within CPU cycles/packet example should be consistent with the forward statistics numbers.

This part is just the sample of the "CPU cycles/packet" output, I think it provides enough context to be understandable without matching Rx packet count in above part of the stats.

Instead of adding 2 samples, do you think using xxx is best? For example:
CPU cycles/packet=xx.dd (total cycles=xxxx / total RX packets=xxxx) at xxxx MHz clock

#26 lore raw

Re: [dpdk-dev] [PATCH v2 3/5] doc: add cycles per packet in testpmd user guide

Quoted 153 lines · Dharmik Thakkar
Quoted 82 lines · Ferruh Yigit
Quoted 77 lines · Dharmik Thakkar

Hi Ferruh,

Quoted 75 lines · Ferruh Yigit
Quoted 56 lines · Dharmik Thakkar

Update documentation for 'show fwd' testpmd runtime function to show CPU cycles/packet example.

---
v2:
- Use shorter lines, up to 100.
---
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 53 +++++++++++++--------

1 file changed, 33 insertions(+), 20 deletions(-)
doc/guides/testpmd_app_ug/testpmd_funcs.rst +15 -20
index a360ecccfd3f..441ed41e3803 100644
@@ -351,26 +351,39 @@ Example for the io forwarding engine, with some packet drops on the tx side::
 
  testpmd> show fwd stats all
 
-     ------- Forward Stats for RX Port= 0/Queue= 0 -> TX Port= 1/Queue= 0 -------
-     RX-packets: 274293770      TX-packets: 274293642      TX-dropped: 128
-
-     ------- Forward Stats for RX Port= 1/Queue= 0 -> TX Port= 0/Queue= 0 -------
-     RX-packets: 274301850      TX-packets: 274301850      TX-dropped: 0
-
-     ---------------------- Forward statistics for port 0  ----------------------
-     RX-packets: 274293802      RX-dropped: 0             RX-total: 274293802
-     TX-packets: 274301862      TX-dropped: 0             TX-total: 274301862
-     ----------------------------------------------------------------------------
-
-     ---------------------- Forward statistics for port 1  ----------------------
-     RX-packets: 274301894      RX-dropped: 0             RX-total: 274301894
-     TX-packets: 274293706      TX-dropped: 128           TX-total: 274293834
-     ----------------------------------------------------------------------------
-
-     +++++++++++++++ Accumulated forward statistics for all ports+++++++++++++++
-     RX-packets: 548595696      RX-dropped: 0             RX-total: 548595696
-     TX-packets: 548595568      TX-dropped: 128           TX-total: 548595696
-     ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+     ------- Forward Stats for RX Port= 0/Queue= 0 -> TX Port= 1/Queue= 0 -------
+     RX-packets: 43536504       TX-packets: 43536488       TX-dropped: 0
+
+     ------- Forward Stats for RX Port= 1/Queue= 0 -> TX Port= 0/Queue= 0 -------
+     RX-packets: 149738504      TX-packets: 149738504      TX-dropped: 0
+
+     ------- Forward Stats for RX Port= 1/Queue= 1 -> TX Port= 0/Queue= 1 -------
+     RX-packets: 149753052      TX-packets: 149753052      TX-dropped: 0
+
+     ---------------------- Forward statistics for port 0  ----------------------
+     RX-packets: 43538881       RX-dropped: 72            RX-total: 43538953
+     TX-packets: 299491753      TX-dropped: 0             TX-total: 299491753
+     ----------------------------------------------------------------------------
+
+     ---------------------- Forward statistics for port 1  ----------------------

doc/guides/testpmd_app_ug/testpmd_funcs.rst Example for the io forwarding engine, with some packet drops on the tx side:: · line 378

Quoted 10 lines
doc/guides/testpmd_app_ug/testpmd_funcs.rst +10 -0
+     RX-packets: 299493085      RX-dropped: 8357          RX-total: 299501442
+     TX-packets: 43539683       TX-dropped: 0             TX-total: 43539683
+     ----------------------------------------------------------------------------
+
+     +++++++++++++++ Accumulated forward statistics for all ports+++++++++++++++
+     RX-packets: 343031966      RX-dropped: 8429          RX-total: 343040395
+     TX-packets: 343031436      TX-dropped: 0             TX-total: 343031436
+     ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+     CPU cycles/packet=14.28 (total cycles=4899533541 / total RX packets=343031966) at 200 MHz Clock

Hi Dharmik,

Overall it is OK to show "CPU cycles/packet", but my concern is numbers can be misleading, because for example the numbers I am getting is like below:

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

CPU cycles/packet=4.38 (total cycles=32871036274 / total RX packets=7511734336) at 2100 MHz Clock

CPU cycles/packet shown above is a part of the example. The numbers are as per the statistics shown in the example.

I know but now you are showing a performance number and it is specific to a platform, my concern it may be misleading and create false expectations for others.

Ok, makes sense.

Quoted 10 lines
Quoted 10 lines
Quoted 9 lines

doc/guides/testpmd_app_ug/testpmd_funcs.rst Example for the io forwarding engine, with some packet drops on the tx side:: · line 382

Quoted 7 lines
doc/guides/testpmd_app_ug/testpmd_funcs.rst +4 -0
+
+.. note::
+
+   Measuring CPU cycles/packet requires enabling CONFIG_RTE_TEST_PMD_RECORD_CORE_TX_CYCLES

s/TX_CYCLES/CYCLES

Quoted 3 lines
Quoted 1 line

Sorry, didn’t understand this comment.

There is no 'CONFIG_RTE_TEST_PMD_RECORD_CORE_TX_CYCLES' config option.

Got it, will update.

Quoted 14 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
doc/guides/testpmd_app_ug/testpmd_funcs.rst +4 -0
+   configuration option. On aarch64 platforms, by default, the cycles are counted using
+   generic counter which runs at a lower frequency than the CPU clock. To get the cycles/packet
+   at CPU clock frequency, please scale the cycles/packet to CPU clock frequency.
+   Alternatively, use the PMU based cycle counter.
Quoted 5 lines
Quoted 2 lines

Not sure the "aarch64 platforms" note suits to here, where documents the command. And I can see the platform documentation already updated for this.

This additional comment about aarch64 platforms is to provide complete information to the users with regards to the config option and offer a better understanding of the CPU cycles/packet numbers. IMO, without this note, CPU cycles/packet numbers can be misleading.

Quoted 8 lines

This is testpmd documentation to describe "show fwd stats" command. We are adding a note to say with a config option it may also show performance data, which is OK. But starting to describe the platform differences for this config option looks to much details for the scope of the document. For testpmd I would prefer command usage independent from platforms, otherwise the documentation may become too confusing/complex.
But agree to provide the information for the specific platform, which you are already doing in other patch in the platform documentation.

Alright, I will remove platform in the next version.

Quoted 20 lines
Quoted 19 lines
Quoted 10 lines

Combining above two comments, what do you think instead of replacing existing stats, add a note saying enabling 'CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES' appends "CPU cycles/packet" and give above two samples, like:

"
Enabling RTE_TEST_PMD_RECORD_CORE_CYCLES appends "CPU cycles/packet" stats, like:

Quoted 6 lines

CPU cycles/packet=4.38 (total cycles=32871036274 / total RX packets=7511734336) at 2100 MHz Clock
OR
CPU cycles/packet=14.28 (total cycles=4899533541 / total RX packets=343031966) at 200 MHz Clock
"

Yes, this is also an option. IMO, numbers shown within CPU cycles/packet example should be consistent with the forward statistics numbers.

Quoted 7 lines
Quoted 3 lines

This part is just the sample of the "CPU cycles/packet" output, I think it provides enough context to be understandable without matching Rx packet count in above part of the stats.

Instead of adding 2 samples, do you think using xxx is best? For example:
CPU cycles/packet=xx.dd (total cycles=xxxx / total RX packets=xxxx) at xxxx MHz clock

+1

#27 lore raw

PATCH v3 1/2 doc: add cycles per packet in testpmd user guide

In reply to Dharmik Thakkar

Update documentation for 'show fwd' testpmd runtime function to show CPU cycles/packet example.

---
v3:
- Keep existing stats and add a note providing CPU cycles/packet example (Ferruh)
- Remove platform specific information (Ferruh)
- Remove performance numbers from CPU cycles/packet example (Ferruh)
- Fix typo in CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES (Ferruh)

v2:
- Use shorter lines, up to 100.

---
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 6 ++++++
 1 file changed, 6 insertions(+)
doc/guides/testpmd_app_ug/testpmd_funcs.rst +6 -0
index 3ded179ee72a..a808b6a308f2 100644
@@ -372,6 +372,12 @@ Example for the io forwarding engine, with some packet drops on the tx side::
      TX-packets: 548595568      TX-dropped: 128           TX-total: 548595696
      ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
+.. note::
+
+   Enabling CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES appends "CPU cycles/packet" stats, like:
+
+   CPU cycles/packet=xx.dd (total cycles=xxxx / total RX packets=xxxx) at xxx MHz clock
+
 clear fwd
 ~~~~~~~~~
 
Signature · 1 line
2.17.1
#28 lore raw

PATCH v3 2/2 doc: include config options in testpmd user guide

Update testpmd documentation to include RECORD configuration options, CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES and CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS.

---
v3:
- Replace config/common_base with build/.config (Thomas)

v2:
- Remove extra '#'.

---
 doc/guides/testpmd_app_ug/build_app.rst | 12 ++++++++++++
 1 file changed, 12 insertions(+)
doc/guides/testpmd_app_ug/build_app.rst +12 -0
index d1ca9f3d19a9..8c9aaa83187f 100644
@@ -21,6 +21,18 @@ The basic compilation steps are:
 
         export RTE_TARGET=x86_64-native-linux-gcc
 
+#.  If required, enable configuration options. For example:
+
+    .. code-block:: console
+
+        cd to the top-level DPDK directory
+        sed -i 's,\(CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES\)=n,\1=y,' build/.config
+        sed -i 's,\(CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS\)=n,\1=y,' build/.config
+
+    Enabling CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES enables measurement of CPU cycles.
+
+    Enabling CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS enables display of RX and TX bursts.
+
 #.  Build the application:
 
     .. code-block:: console
Signature · 1 line
2.17.1
#29 lore raw

Re: [dpdk-dev] [PATCH v3 2/2] doc: include config options in testpmd user guide

Quoted 31 lines · Dharmik Thakkar

Update testpmd documentation to include RECORD configuration options, CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES and CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS.

---
v3:
- Replace config/common_base with build/.config (Thomas)

v2:
- Remove extra '#'.

---
 doc/guides/testpmd_app_ug/build_app.rst | 12 ++++++++++++
 1 file changed, 12 insertions(+)
doc/guides/testpmd_app_ug/build_app.rst +5 -0
index d1ca9f3d19a9..8c9aaa83187f 100644
@@ -21,6 +21,18 @@ The basic compilation steps are:
 
         export RTE_TARGET=x86_64-native-linux-gcc
 
+#.  If required, enable configuration options. For example:
+
+    .. code-block:: console
+
+        cd to the top-level DPDK directory

doc/guides/testpmd_app_ug/build_app.rst The basic compilation steps are: · line 38

Quoted 10 lines
doc/guides/testpmd_app_ug/build_app.rst +7 -0
+        sed -i 's,\(CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES\)=n,\1=y,' build/.config
+        sed -i 's,\(CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS\)=n,\1=y,' build/.config
+
+    Enabling CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES enables measurement of CPU cycles.
+
+    Enabling CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS enables display of RX and TX bursts.
+
 #.  Build the application:
 
     .. code-block:: console

Hi Dharmik,

This patch waiting to address the Thomas comment on document how to enable those config options in meson. @Thomas, can you please correct if I got it wrong?

#30 lore raw

Re: [dpdk-dev] [PATCH v3 2/2] doc: include config options in testpmd user guide

17/06/2020 20:21, Ferruh Yigit:

Quoted 40 lines · Dharmik Thakkar
Quoted 39 lines

Update testpmd documentation to include RECORD configuration options, CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES and CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS.

---
v3:
- Replace config/common_base with build/.config (Thomas)

v2:
- Remove extra '#'.

---
 doc/guides/testpmd_app_ug/build_app.rst | 12 ++++++++++++
 1 file changed, 12 insertions(+)
doc/guides/testpmd_app_ug/build_app.rst +12 -0
index d1ca9f3d19a9..8c9aaa83187f 100644
@@ -21,6 +21,18 @@ The basic compilation steps are:
 
         export RTE_TARGET=x86_64-native-linux-gcc
 
+#.  If required, enable configuration options. For example:
+
+    .. code-block:: console
+
+        cd to the top-level DPDK directory
+        sed -i 's,\(CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES\)=n,\1=y,' build/.config
+        sed -i 's,\(CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS\)=n,\1=y,' build/.config
+
+    Enabling CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES enables measurement of CPU cycles.
+
+    Enabling CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS enables display of RX and TX bursts.
+
 #.  Build the application:
 
Quoted 7 lines

doc/guides/testpmd_app_ug/build_app.rst The basic compilation steps are: · line 38

Quoted 2 lines
doc/guides/testpmd_app_ug/build_app.rst +0 -0
     .. code-block:: console

Hi Dharmik,

This patch waiting to address the Thomas comment on document how to enable those config options in meson. @Thomas, can you please correct if I got it wrong?

If the doc is only about make, it will be removed in 2 months. So yes, I think it doesn't make sense to be merged as is.

#31 lore raw

Re: [dpdk-dev] [PATCH v3 2/2] doc: include config options in testpmd user guide

+ Bruce

Quoted 48 lines · Thomas Monjalon

17/06/2020 20:21, Ferruh Yigit:

Quoted 45 lines · Dharmik Thakkar
Quoted 31 lines

Update testpmd documentation to include RECORD configuration options, CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES and CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS.

---
v3:
- Replace config/common_base with build/.config (Thomas)

v2:
- Remove extra '#'.
---
doc/guides/testpmd_app_ug/build_app.rst | 12 ++++++++++++

1 file changed, 12 insertions(+)
doc/guides/testpmd_app_ug/build_app.rst +5 -0
index d1ca9f3d19a9..8c9aaa83187f 100644
@@ -21,6 +21,18 @@ The basic compilation steps are:
 
        export RTE_TARGET=x86_64-native-linux-gcc
 
+#.  If required, enable configuration options. For example:
+
+    .. code-block:: console
+
+        cd to the top-level DPDK directory

doc/guides/testpmd_app_ug/build_app.rst The basic compilation steps are: · line 38

Quoted 10 lines
doc/guides/testpmd_app_ug/build_app.rst +7 -0
+        sed -i 's,\(CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES\)=n,\1=y,' build/.config
+        sed -i 's,\(CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS\)=n,\1=y,' build/.config
+
+    Enabling CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES enables measurement of CPU cycles.
+
+    Enabling CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS enables display of RX and TX bursts.
+
 #.  Build the application:
 
    .. code-block:: console

Hi Dharmik,

Quoted 6 lines
Quoted 2 lines

This patch waiting to address the Thomas comment on document how to enable those config options in meson. @Thomas, can you please correct if I got it wrong?

If the doc is only about make, it will be removed in 2 months. So yes, I think it doesn't make sense to be merged as is.

Make sense.

With meson, I see multiple ways to enable configuration options:

1] macro in $(RTE_SDK)/config/rte_config.h
2] using dpdk_conf.set() in $(RTE_SDK)/config/meson.build

I’d appreciate some suggestions on the best way to enable these options.

Quoted 2 lines
#32 lore raw

Re: [dpdk-dev] [PATCH v3 2/2] doc: include config options in testpmd user guide

19/06/2020 17:38, Dharmik Thakkar:

Quoted 57 lines

+ Bruce

Quoted 48 lines · Thomas Monjalon

17/06/2020 20:21, Ferruh Yigit:

Quoted 45 lines · Dharmik Thakkar
Quoted 31 lines

Update testpmd documentation to include RECORD configuration options, CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES and CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS.

---
v3:
- Replace config/common_base with build/.config (Thomas)

v2:
- Remove extra '#'.
---
doc/guides/testpmd_app_ug/build_app.rst | 12 ++++++++++++

1 file changed, 12 insertions(+)
doc/guides/testpmd_app_ug/build_app.rst +5 -0
index d1ca9f3d19a9..8c9aaa83187f 100644
@@ -21,6 +21,18 @@ The basic compilation steps are:
 
        export RTE_TARGET=x86_64-native-linux-gcc
 
+#.  If required, enable configuration options. For example:
+
+    .. code-block:: console
+
+        cd to the top-level DPDK directory

doc/guides/testpmd_app_ug/build_app.rst The basic compilation steps are: · line 38

Quoted 10 lines
doc/guides/testpmd_app_ug/build_app.rst +7 -0
+        sed -i 's,\(CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES\)=n,\1=y,' build/.config
+        sed -i 's,\(CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS\)=n,\1=y,' build/.config
+
+    Enabling CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES enables measurement of CPU cycles.
+
+    Enabling CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS enables display of RX and TX bursts.
+
 #.  Build the application:
 
    .. code-block:: console

Hi Dharmik,

Quoted 6 lines
Quoted 2 lines

This patch waiting to address the Thomas comment on document how to enable those config options in meson. @Thomas, can you please correct if I got it wrong?

If the doc is only about make, it will be removed in 2 months. So yes, I think it doesn't make sense to be merged as is.

Quoted 8 lines

Make sense.

With meson, I see multiple ways to enable configuration options:

1] macro in $(RTE_SDK)/config/rte_config.h
2] using dpdk_conf.set() in $(RTE_SDK)/config/meson.build

I’d appreciate some suggestions on the best way to enable these options.

Neither 1 nor 2 because both are source files. Configuration must be done in the build directory.

We use "meson -D" to configure options listed in meson_options.txt The real question is which option we accept to be added.

#33 lore raw

Re: [dpdk-dev] [PATCH v3 2/2] doc: include config options in testpmd user guide

Quoted 69 lines · Thomas Monjalon

19/06/2020 17:38, Dharmik Thakkar:

Quoted 64 lines

+ Bruce

Quoted 48 lines · Thomas Monjalon

17/06/2020 20:21, Ferruh Yigit:

Quoted 45 lines · Dharmik Thakkar
Quoted 31 lines

Update testpmd documentation to include RECORD configuration options, CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES and CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS.

---
v3:
- Replace config/common_base with build/.config (Thomas)

v2:
- Remove extra '#'.
---
doc/guides/testpmd_app_ug/build_app.rst | 12 ++++++++++++

1 file changed, 12 insertions(+)
doc/guides/testpmd_app_ug/build_app.rst +5 -0
index d1ca9f3d19a9..8c9aaa83187f 100644
@@ -21,6 +21,18 @@ The basic compilation steps are:
 
       export RTE_TARGET=x86_64-native-linux-gcc
 
+#.  If required, enable configuration options. For example:
+
+    .. code-block:: console
+
+        cd to the top-level DPDK directory

doc/guides/testpmd_app_ug/build_app.rst The basic compilation steps are: · line 38

Quoted 10 lines
doc/guides/testpmd_app_ug/build_app.rst +7 -0
+        sed -i 's,\(CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES\)=n,\1=y,' build/.config
+        sed -i 's,\(CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS\)=n,\1=y,' build/.config
+
+    Enabling CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES enables measurement of CPU cycles.
+
+    Enabling CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS enables display of RX and TX bursts.
+
 #.  Build the application:
 
   .. code-block:: console

Hi Dharmik,

Quoted 6 lines
Quoted 2 lines

This patch waiting to address the Thomas comment on document how to enable those config options in meson. @Thomas, can you please correct if I got it wrong?

If the doc is only about make, it will be removed in 2 months. So yes, I think it doesn't make sense to be merged as is.

Make sense.

With meson, I see multiple ways to enable configuration options:

1] macro in $(RTE_SDK)/config/rte_config.h
2] using dpdk_conf.set() in $(RTE_SDK)/config/meson.build

Quoted 9 lines
Quoted 1 line

I’d appreciate some suggestions on the best way to enable these options.

Neither 1 nor 2 because both are source files. Configuration must be done in the build directory.

We use "meson -D" to configure options listed in meson_options.txt The real question is which option we accept to be added.

Yes, correct. There are suggestions for making these as runtime configuration functions which can be enabled(or disabled) using ’set’ from within the application. Do you think, till this change is implemented, these options can be included in meson_options.txt?

Quoted 1 line
#34 lore raw

Re: [dpdk-dev] [PATCH v3 2/2] doc: include config options in testpmd user guide

19/06/2020 18:13, Dharmik Thakkar:

Quoted 68 lines
Quoted 68 lines · Thomas Monjalon

19/06/2020 17:38, Dharmik Thakkar:

Quoted 54 lines
Quoted 47 lines · Thomas Monjalon

17/06/2020 20:21, Ferruh Yigit:

Quoted 45 lines · Dharmik Thakkar
Quoted 31 lines

Update testpmd documentation to include RECORD configuration options, CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES and CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS.

---
v3:
- Replace config/common_base with build/.config (Thomas)

v2:
- Remove extra '#'.
---
doc/guides/testpmd_app_ug/build_app.rst | 12 ++++++++++++

1 file changed, 12 insertions(+)
doc/guides/testpmd_app_ug/build_app.rst +5 -0
index d1ca9f3d19a9..8c9aaa83187f 100644
@@ -21,6 +21,18 @@ The basic compilation steps are:
 
       export RTE_TARGET=x86_64-native-linux-gcc
 
+#.  If required, enable configuration options. For example:
+
+    .. code-block:: console
+
+        cd to the top-level DPDK directory

doc/guides/testpmd_app_ug/build_app.rst The basic compilation steps are: · line 38

Quoted 10 lines
doc/guides/testpmd_app_ug/build_app.rst +7 -0
+        sed -i 's,\(CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES\)=n,\1=y,' build/.config
+        sed -i 's,\(CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS\)=n,\1=y,' build/.config
+
+    Enabling CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES enables measurement of CPU cycles.
+
+    Enabling CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS enables display of RX and TX bursts.
+
 #.  Build the application:
 
   .. code-block:: console

Hi Dharmik,

Quoted 6 lines
Quoted 2 lines

This patch waiting to address the Thomas comment on document how to enable those config options in meson. @Thomas, can you please correct if I got it wrong?

If the doc is only about make, it will be removed in 2 months. So yes, I think it doesn't make sense to be merged as is.

Quoted 8 lines

Make sense.

With meson, I see multiple ways to enable configuration options:

1] macro in $(RTE_SDK)/config/rte_config.h
2] using dpdk_conf.set() in $(RTE_SDK)/config/meson.build

I’d appreciate some suggestions on the best way to enable these options.

Neither 1 nor 2 because both are source files. Configuration must be done in the build directory.

Quoted 6 lines
Quoted 4 lines

We use "meson -D" to configure options listed in meson_options.txt The real question is which option we accept to be added.

Yes, correct. There are suggestions for making these as runtime configuration functions which can be enabled(or disabled) using ’set’ from within the application.

I don't understand this proposal.
Is there a patch?

Quoted 1 line

Do you think, till this change is implemented, these options can be included in meson_options.txt?

In general, if you think there is a better alternative, please propose a patch.

I have no opinion what is best to manage such option.

#35 lore raw

Re: [dpdk-dev] [PATCH v3 2/2] doc: include config options in testpmd user guide

Quoted 80 lines · Thomas Monjalon

19/06/2020 18:13, Dharmik Thakkar:

Quoted 68 lines
Quoted 68 lines · Thomas Monjalon

19/06/2020 17:38, Dharmik Thakkar:

Quoted 54 lines
Quoted 47 lines · Thomas Monjalon

17/06/2020 20:21, Ferruh Yigit:

Quoted 45 lines · Dharmik Thakkar
Quoted 31 lines

Update testpmd documentation to include RECORD configuration options, CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES and CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS.

---
v3:
- Replace config/common_base with build/.config (Thomas)

v2:
- Remove extra '#'.
---
doc/guides/testpmd_app_ug/build_app.rst | 12 ++++++++++++

1 file changed, 12 insertions(+)
doc/guides/testpmd_app_ug/build_app.rst +5 -0
index d1ca9f3d19a9..8c9aaa83187f 100644
@@ -21,6 +21,18 @@ The basic compilation steps are:
 
      export RTE_TARGET=x86_64-native-linux-gcc
 
+#.  If required, enable configuration options. For example:
+
+    .. code-block:: console
+
+        cd to the top-level DPDK directory

doc/guides/testpmd_app_ug/build_app.rst The basic compilation steps are: · line 38

Quoted 10 lines
doc/guides/testpmd_app_ug/build_app.rst +7 -0
+        sed -i 's,\(CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES\)=n,\1=y,' build/.config
+        sed -i 's,\(CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS\)=n,\1=y,' build/.config
+
+    Enabling CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES enables measurement of CPU cycles.
+
+    Enabling CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS enables display of RX and TX bursts.
+
 #.  Build the application:
 
  .. code-block:: console

Hi Dharmik,

Quoted 6 lines
Quoted 2 lines

This patch waiting to address the Thomas comment on document how to enable those config options in meson. @Thomas, can you please correct if I got it wrong?

If the doc is only about make, it will be removed in 2 months. So yes, I think it doesn't make sense to be merged as is.

Quoted 8 lines

Make sense.

With meson, I see multiple ways to enable configuration options:

1] macro in $(RTE_SDK)/config/rte_config.h
2] using dpdk_conf.set() in $(RTE_SDK)/config/meson.build

I’d appreciate some suggestions on the best way to enable these options.

Neither 1 nor 2 because both are source files. Configuration must be done in the build directory.

Quoted 6 lines
Quoted 4 lines

We use "meson -D" to configure options listed in meson_options.txt The real question is which option we accept to be added.

Yes, correct. There are suggestions for making these as runtime configuration functions which can be enabled(or disabled) using ’set’ from within the application.

Quoted 7 lines

I don't understand this proposal.
Is there a patch?

Quoted 1 line

Do you think, till this change is implemented, these options can be included in meson_options.txt?

In general, if you think there is a better alternative, please propose a patch.

I am not sure if changing it to a runtime function is a better alternative.
I am expecting some performance degradation with the change since the macros will be replaced with ‘if’ statements. I will hack up a patch to see the performance difference and propose if there is not much of a difference.

Quoted 2 lines

I have no opinion what is best to manage such option.

#36 lore raw

cover app/testpmd: add runtime config

In reply to Dharmik Thakkar

Meson build system lacks support for CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES and CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS configuration options.

One solution is to add these options within meson_options.txt

Since adding these as runtime config causes no performance impact, it makes sense to enable these as runtime config alongside other available runtime options within testpmd.

Dharmik Thakkar (5):
app/testpmd: add record-core-cycles runtime config
doc: add record-core-cycles to testpmd funcs doc app/testpmd: add record-burst-stats runtime config
doc: add record-burst-stats to testpmd funcs doc app/testpmd: enable empty polls in 5tswap

Phil Yang (1):
app/testpmd: enable burst stats for noisy vnf mode

 app/test-pmd/5tswap.c                       | 25 ++----
 app/test-pmd/cmdline.c                      | 92 +++++++++++++++++++++
 app/test-pmd/config.c                       | 12 +++
 app/test-pmd/csumonly.c                     | 24 ++----
 app/test-pmd/flowgen.c                      | 21 ++---
 app/test-pmd/icmpecho.c                     | 24 ++----
 app/test-pmd/iofwd.c                        | 26 ++----
 app/test-pmd/macfwd.c                       | 25 ++----
 app/test-pmd/macswap.c                      | 24 ++----
 app/test-pmd/noisy_vnf.c                    |  4 +
 app/test-pmd/parameters.c                   | 11 ++-
 app/test-pmd/rxonly.c                       | 19 +----
 app/test-pmd/testpmd.c                      | 77 ++++++++---------
 app/test-pmd/testpmd.h                      | 38 +++++++--
 app/test-pmd/txonly.c                       | 20 +----
 doc/guides/testpmd_app_ug/run_app.rst       |  8 ++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 30 +++++++
 17 files changed, 272 insertions(+), 208 deletions(-)
Signature · 1 line
2.17.1
#37 lore raw

PATCH 1/6 app/testpmd: add record-core-cycles runtime config

Convert CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES to a runtime configuration.

---
 app/test-pmd/5tswap.c     | 16 +++-----------
 app/test-pmd/cmdline.c    | 46 +++++++++++++++++++++++++++++++++++++++
 app/test-pmd/config.c     |  6 +++++
 app/test-pmd/csumonly.c   | 16 +++-----------
 app/test-pmd/flowgen.c    | 17 ++++-----------
 app/test-pmd/icmpecho.c   | 16 +++-----------
 app/test-pmd/iofwd.c      | 18 ++++-----------
 app/test-pmd/macfwd.c     | 17 ++++-----------
 app/test-pmd/macswap.c    | 16 +++-----------
 app/test-pmd/parameters.c |  6 ++++-
 app/test-pmd/rxonly.c     | 15 +++----------
 app/test-pmd/testpmd.c    | 44 ++++++++++++++++++-------------------
 app/test-pmd/testpmd.h    | 18 +++++++++++++--
 app/test-pmd/txonly.c     | 16 +++-----------
 14 files changed, 125 insertions(+), 142 deletions(-)
app/test-pmd/5tswap.c +3 -13
index 972f6b93b31d..04f035bb450f 100644
@@ -105,15 +105,9 @@ pkt_burst_5tuple_swap(struct fwd_stream *fs)
 		uint8_t *byte;
 	} h;
 
-#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
-	uint64_t start_tsc;
-	uint64_t end_tsc;
-	uint64_t core_cycles;
-#endif
+	uint64_t start_tsc = 0;
 
-#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
-	start_tsc = rte_rdtsc();
-#endif
+	get_start_cycles(&start_tsc);
 
 	/*
 	 * Receive a burst of packets and forward them.
@@ -193,11 +187,7 @@ pkt_burst_5tuple_swap(struct fwd_stream *fs)
 			rte_pktmbuf_free(pkts_burst[nb_tx]);
 		} while (++nb_tx < nb_rx);
 	}
-#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
-	end_tsc = rte_rdtsc();
-	core_cycles = (end_tsc - start_tsc);
-	fs->core_cycles = (uint64_t) (fs->core_cycles + core_cycles);
-#endif
+	get_end_cycles(fs, start_tsc);
 }
 
 struct fwd_engine five_tuple_swap_fwd_engine = {
app/test-pmd/cmdline.c +46 -0

64 lines not on this page · raw message

app/test-pmd/config.c +6 -0
index fcbe6b6f7440..d93699b34e3a 100644
@@ -3679,6 +3679,12 @@ set_xstats_hide_zero(uint8_t on_off)
 	xstats_hide_zero = on_off;
 }
 
+void
+set_record_core_cycles(uint8_t on_off)
+{
+	record_core_cycles = on_off;
+}
+
 static inline void
 print_fdir_mask(struct rte_eth_fdir_masks *mask)
 {
app/test-pmd/csumonly.c +3 -13
index 0a96b24eb27b..836bafa0f6df 100644
@@ -789,15 +789,9 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
 	uint16_t nb_segments = 0;
 	int ret;
 
-#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
-	uint64_t start_tsc;
-	uint64_t end_tsc;
-	uint64_t core_cycles;
-#endif
+	uint64_t start_tsc = 0;
 
-#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
-	start_tsc = rte_rdtsc();
-#endif
+	get_start_cycles(&start_tsc);
 
 	/* receive a burst of packet */
 	nb_rx = rte_eth_rx_burst(fs->rx_port, fs->rx_queue, pkts_burst,
@@ -1098,11 +1092,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
 		} while (++nb_tx < nb_rx);
 	}
 
-#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
-	end_tsc = rte_rdtsc();
-	core_cycles = (end_tsc - start_tsc);
-	fs->core_cycles = (uint64_t) (fs->core_cycles + core_cycles);
-#endif
+	get_end_cycles(fs, start_tsc);
 }
 
 struct fwd_engine csum_fwd_engine = {
app/test-pmd/flowgen.c +4 -13
index 4bd351e6754a..e92a0eeca254 100644
@@ -97,16 +97,10 @@ pkt_burst_flow_gen(struct fwd_stream *fs)
 	uint16_t i;
 	uint32_t retry;
 	uint64_t tx_offloads;
-#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
-	uint64_t start_tsc;
-	uint64_t end_tsc;
-	uint64_t core_cycles;
-#endif
+	uint64_t start_tsc = 0;
 	static int next_flow = 0;
 
-#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
-	start_tsc = rte_rdtsc();
-#endif
+	get_start_cycles(&start_tsc);
 
 	/* Receive a burst of packets and discard them. */
 	nb_rx = rte_eth_rx_burst(fs->rx_port, fs->rx_queue, pkts_burst,
@@ -207,11 +201,8 @@ pkt_burst_flow_gen(struct fwd_stream *fs)
 			rte_pktmbuf_free(pkts_burst[nb_tx]);
 		} while (++nb_tx < nb_pkt);
 	}
-#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
-	end_tsc = rte_rdtsc();
-	core_cycles = (end_tsc - start_tsc);
-	fs->core_cycles = (uint64_t) (fs->core_cycles + core_cycles);
-#endif
+
+	get_end_cycles(fs, start_tsc);
 }
 
 struct fwd_engine flow_gen_engine = {
app/test-pmd/icmpecho.c +3 -13
index 78e3adf2c106..3f27e8c29d33 100644
@@ -293,15 +293,9 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs)
 	uint32_t cksum;
 	uint8_t  i;
 	int l2_len;
-#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
-	uint64_t start_tsc;
-	uint64_t end_tsc;
-	uint64_t core_cycles;
-#endif
+	uint64_t start_tsc = 0;
 
-#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
-	start_tsc = rte_rdtsc();
-#endif
+	get_start_cycles(&start_tsc);
 
 	/*
 	 * First, receive a burst of packets.
@@ -520,11 +514,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs)
 		}
 	}
 
-#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
-	end_tsc = rte_rdtsc();
-	core_cycles = (end_tsc - start_tsc);
-	fs->core_cycles = (uint64_t) (fs->core_cycles + core_cycles);
-#endif
+	get_end_cycles(fs, start_tsc);
 }
 
 struct fwd_engine icmp_echo_engine = {
app/test-pmd/iofwd.c +4 -14
index 22b59bbdaf5a..456f7b5925ed 100644
@@ -50,16 +50,9 @@ pkt_burst_io_forward(struct fwd_stream *fs)
 	uint16_t nb_rx;
 	uint16_t nb_tx;
 	uint32_t retry;
+	uint64_t start_tsc = 0;
 
-#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
-	uint64_t start_tsc;
-	uint64_t end_tsc;
-	uint64_t core_cycles;
-#endif
-
-#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
-	start_tsc = rte_rdtsc();
-#endif
+	get_start_cycles(&start_tsc);
 
 	/*
 	 * Receive a burst of packets and forward them.
@@ -96,11 +89,8 @@ pkt_burst_io_forward(struct fwd_stream *fs)
 			rte_pktmbuf_free(pkts_burst[nb_tx]);
 		} while (++nb_tx < nb_rx);
 	}
-#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
-	end_tsc = rte_rdtsc();
-	core_cycles = (end_tsc - start_tsc);
-	fs->core_cycles = (uint64_t) (fs->core_cycles + core_cycles);
-#endif
+
+	get_end_cycles(fs, start_tsc);
 }
 
 struct fwd_engine io_fwd_engine = {
app/test-pmd/macfwd.c +4 -13
index 0a89d94befe5..6a77568c7e60 100644
@@ -56,15 +56,9 @@ pkt_burst_mac_forward(struct fwd_stream *fs)
 	uint16_t i;
 	uint64_t ol_flags = 0;
 	uint64_t tx_offloads;
-#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
-	uint64_t start_tsc;
-	uint64_t end_tsc;
-	uint64_t core_cycles;
-#endif
+	uint64_t start_tsc = 0;
 
-#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
-	start_tsc = rte_rdtsc();
-#endif
+	get_start_cycles(&start_tsc);
 
 	/*
 	 * Receive a burst of packets and forward them.
@@ -126,11 +120,8 @@ pkt_burst_mac_forward(struct fwd_stream *fs)
 			rte_pktmbuf_free(pkts_burst[nb_tx]);
 		} while (++nb_tx < nb_rx);
 	}
-#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
-	end_tsc = rte_rdtsc();
-	core_cycles = (end_tsc - start_tsc);
-	fs->core_cycles = (uint64_t) (fs->core_cycles + core_cycles);
-#endif
+
+	get_end_cycles(fs, start_tsc);
 }
 
 struct fwd_engine mac_fwd_engine = {
app/test-pmd/macswap.c +3 -13
index fbe8cb39e5d2..aaef5b0047b1 100644
@@ -57,15 +57,9 @@ pkt_burst_mac_swap(struct fwd_stream *fs)
 	uint16_t nb_rx;
 	uint16_t nb_tx;
 	uint32_t retry;
-#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
-	uint64_t start_tsc;
-	uint64_t end_tsc;
-	uint64_t core_cycles;
-#endif
+	uint64_t start_tsc = 0;
 
-#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
-	start_tsc = rte_rdtsc();
-#endif
+	get_start_cycles(&start_tsc);
 
 	/*
 	 * Receive a burst of packets and forward them.
@@ -105,11 +99,7 @@ pkt_burst_mac_swap(struct fwd_stream *fs)
 			rte_pktmbuf_free(pkts_burst[nb_tx]);
 		} while (++nb_tx < nb_rx);
 	}
-#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
-	end_tsc = rte_rdtsc();
-	core_cycles = (end_tsc - start_tsc);
-	fs->core_cycles = (uint64_t) (fs->core_cycles + core_cycles);
-#endif
+	get_end_cycles(fs, start_tsc);
 }
 
 struct fwd_engine mac_swap_engine = {
app/test-pmd/parameters.c +5 -1
index 7cb0e3d6ec0a..76072ae81b93 100644
@@ -70,7 +70,7 @@ usage(char* progname)
 	       "--rxpt= | --rxht= | --rxwt= | --rxfreet= | "
 	       "--txpt= | --txht= | --txwt= | --txfreet= | "
 	       "--txrst= | --tx-offloads= | | --rx-offloads= | "
-	       "--vxlan-gpe-port= ]\n",
+	       "--vxlan-gpe-port= | --record-core-cycles]\n",
 	       progname);
 #ifdef RTE_LIBRTE_CMDLINE
 	printf("  --interactive: run in interactive mode.\n");
@@ -216,6 +216,7 @@ usage(char* progname)
 	       "valid only with --mp-alloc=anon\n");
 	printf("  --rx-mq-mode=0xX: hexadecimal bitmask of RX mq mode can be "
 	       "enabled\n");
+	printf("  --record-core-cycles: enable measurement of CPU cycles.\n");
 }
 
 #ifdef RTE_LIBRTE_CMDLINE
@@ -677,6 +678,7 @@ launch_args_parse(int argc, char** argv)
 		{ "noisy-lkup-num-reads-writes", 1, 0, 0 },
 		{ "no-iova-contig",             0, 0, 0 },
 		{ "rx-mq-mode",                 1, 0, 0 },
+		{ "record-core-cycles",         0, 0, 0 },
 		{ 0, 0, 0, 0 },
 	};
 
@@ -1381,6 +1383,8 @@ launch_args_parse(int argc, char** argv)
 						 "rx-mq-mode must be >= 0 and <= %d\n",
 						 ETH_MQ_RX_VMDQ_DCB_RSS);
 			}
+			if (!strcmp(lgopts[opt_idx].name, "record-core-cycles"))
+				record_core_cycles = 1;
 			break;
 		case 'h':
 			usage(argv[0]);
app/test-pmd/rxonly.c +3 -12
index 18d59a68d652..b6c8b8c7d5db 100644
@@ -49,14 +49,9 @@ pkt_burst_receive(struct fwd_stream *fs)
 	struct rte_mbuf  *pkts_burst[MAX_PKT_BURST];
 	uint16_t nb_rx;
 	uint16_t i;
+	uint64_t start_tsc = 0;
 
-#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
-	uint64_t start_tsc;
-	uint64_t end_tsc;
-	uint64_t core_cycles;
-
-	start_tsc = rte_rdtsc();
-#endif
+	get_start_cycles(&start_tsc);
 
 	/*
 	 * Receive a burst of packets.
@@ -73,11 +68,7 @@ pkt_burst_receive(struct fwd_stream *fs)
 	for (i = 0; i < nb_rx; i++)
 		rte_pktmbuf_free(pkts_burst[i]);
 
-#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
-	end_tsc = rte_rdtsc();
-	core_cycles = (end_tsc - start_tsc);
-	fs->core_cycles = (uint64_t) (fs->core_cycles + core_cycles);
-#endif
+	get_end_cycles(fs, start_tsc);
 }
 
 struct fwd_engine rx_only_engine = {
app/test-pmd/testpmd.c +22 -22

79 lines not on this page · raw message

app/test-pmd/testpmd.h +16 -2
index 25a12b14f29d..dcc37be02d59 100644
@@ -129,9 +129,7 @@ struct fwd_stream {
 	uint64_t rx_bad_outer_l4_csum;
 	/**< received packets has bad outer l4 checksum */
 	unsigned int gro_times;	/**< GRO operation times */
-#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
 	uint64_t     core_cycles; /**< used for RX and TX processing */
-#endif
 #ifdef RTE_TEST_PMD_RECORD_BURST_STATS
 	struct pkt_burst_stats rx_burst_stats;
 	struct pkt_burst_stats tx_burst_stats;
@@ -301,6 +299,7 @@ extern uint16_t nb_rx_queue_stats_mappings;
 extern uint8_t xstats_hide_zero; /**< Hide zero values for xstats display */
 
 /* globals used for configuration */
+extern uint8_t record_core_cycles; /**< Enables measurement of CPU cycles */
 extern uint16_t verbose_level; /**< Drives messages being displayed, if any. */
 extern int testpmd_logtype; /**< Log type for testpmd logs */
 extern uint8_t  interactive;
@@ -681,6 +680,20 @@ port_pci_reg_write(struct rte_port *port, uint32_t reg_off, uint32_t reg_v)
 #define port_id_pci_reg_write(pt_id, reg_off, reg_value) \
 	port_pci_reg_write(&ports[(pt_id)], (reg_off), (reg_value))
 
+static inline void
+get_start_cycles(uint64_t *start_tsc)
+{
+	if (record_core_cycles)
+		*start_tsc = rte_rdtsc();
+}
+
+static inline void
+get_end_cycles(struct fwd_stream *fs, uint64_t start_tsc)
+{
+	if (record_core_cycles)
+		fs->core_cycles += rte_rdtsc() - start_tsc;
+}
+
 /* Prototypes */
 unsigned int parse_item_list(char* str, const char* item_name,
 			unsigned int max_items,
@@ -772,6 +785,7 @@ void set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id, uint8_t map_va
 
 void set_xstats_hide_zero(uint8_t on_off);
 
+void set_record_core_cycles(uint8_t on_off);
 void set_verbose_level(uint16_t vb_level);
 void set_tx_pkt_segments(unsigned *seg_lengths, unsigned nb_segs);
 void show_tx_pkt_segments(void);
app/test-pmd/txonly.c +3 -13
index 97f4a452da12..00a3a6f90c7a 100644
@@ -294,15 +294,9 @@ pkt_burst_transmit(struct fwd_stream *fs)
 	uint32_t retry;
 	uint64_t ol_flags = 0;
 	uint64_t tx_offloads;
-#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
-	uint64_t start_tsc;
-	uint64_t end_tsc;
-	uint64_t core_cycles;
-#endif
+	uint64_t start_tsc = 0;
 
-#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
-	start_tsc = rte_rdtsc();
-#endif
+	get_start_cycles(&start_tsc);
 
 	mbp = current_fwd_lcore()->mbp;
 	txp = &ports[fs->tx_port];
@@ -391,11 +385,7 @@ pkt_burst_transmit(struct fwd_stream *fs)
 		} while (++nb_tx < nb_pkt);
 	}
 
-#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
-	end_tsc = rte_rdtsc();
-	core_cycles = (end_tsc - start_tsc);
-	fs->core_cycles = (uint64_t) (fs->core_cycles + core_cycles);
-#endif
+	get_end_cycles(fs, start_tsc);
 }
 
 static void
Signature · 1 line
2.17.1
#38 lore raw

PATCH 2/6 doc: add record-core-cycles to testpmd funcs doc

In reply to Dharmik Thakkar

Update documentation to include description of 'record-core-cycles' runtime configuration.

---
 doc/guides/testpmd_app_ug/run_app.rst       |  6 ++++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 15 +++++++++++++++
 2 files changed, 21 insertions(+)
doc/guides/testpmd_app_ug/run_app.rst +6 -0
index d1e4ee3e7a46..2b8e0ad69157 100644
@@ -489,3 +489,9 @@ The command line options are:
     The default value is 0x7::
 
        ETH_MQ_RX_RSS_FLAG | ETH_MQ_RX_DCB_FLAG | ETH_MQ_RX_VMDQ_FLAG
+
+*   ``--record-core-cycles``
+
+    Enable measurement of CPU cycles per packet.
+
+
doc/guides/testpmd_app_ug/testpmd_funcs.rst +15 -0
index f8cfb02e38ab..980bf3340763 100644
@@ -710,6 +710,21 @@ Set the forwarding ports hexadecimal mask::
 
 This is equivalent to the ``--portmask`` command-line option.
 
+set record-core-cycles
+~~~~~~~~~~~~~~~~~~~~~~
+
+Set the recording of CPU cycles::
+
+   testpmd> set record-core-cycles (on|off)
+
+Where:
+
+* ``on`` enables measurement of CPU cycles per packet.
+
+* ``off`` disables measurement of CPU cycles per packet.
+
+This is equivalent to the ``--record-core-cycles command-line`` option.
+
 set burst
 ~~~~~~~~~
 
Signature · 1 line
2.17.1
#39 lore raw

PATCH 3/6 app/testpmd: add record-burst-stats runtime config

In reply to Dharmik Thakkar

Convert CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS to a runtime configuration.

---
 app/test-pmd/5tswap.c     |  8 ++-----
 app/test-pmd/cmdline.c    | 46 +++++++++++++++++++++++++++++++++++++++
 app/test-pmd/config.c     |  6 +++++
 app/test-pmd/csumonly.c   |  8 ++-----
 app/test-pmd/flowgen.c    |  4 +---
 app/test-pmd/icmpecho.c   |  8 ++-----
 app/test-pmd/iofwd.c      |  8 ++-----
 app/test-pmd/macfwd.c     |  8 ++-----
 app/test-pmd/macswap.c    |  8 ++-----
 app/test-pmd/parameters.c |  7 +++++-
 app/test-pmd/rxonly.c     |  4 +---
 app/test-pmd/testpmd.c    | 33 ++++++++++++++--------------
 app/test-pmd/testpmd.h    | 20 +++++++++++++----
 app/test-pmd/txonly.c     |  4 +---
 14 files changed, 106 insertions(+), 66 deletions(-)
app/test-pmd/5tswap.c +2 -6
index 04f035bb450f..d9026ce86556 100644
@@ -117,9 +117,7 @@ pkt_burst_5tuple_swap(struct fwd_stream *fs)
 	if (unlikely(nb_rx == 0))
 		return;
 
-#ifdef RTE_TEST_PMD_RECORD_BURST_STATS
-	fs->rx_burst_stats.pkt_burst_spread[nb_rx]++;
-#endif
+	inc_rx_burst_stats(fs, nb_rx);
 
 	fs->rx_packets += nb_rx;
 	txp = &ports[fs->tx_port];
@@ -178,9 +176,7 @@ pkt_burst_5tuple_swap(struct fwd_stream *fs)
 		}
 	}
 	fs->tx_packets += nb_tx;
-#ifdef RTE_TEST_PMD_RECORD_BURST_STATS
-	fs->tx_burst_stats.pkt_burst_spread[nb_tx]++;
-#endif
+	inc_tx_burst_stats(fs, nb_tx);
 	if (unlikely(nb_tx < nb_rx)) {
 		fs->fwd_dropped += (nb_rx - nb_tx);
 		do {
app/test-pmd/cmdline.c +46 -0

64 lines not on this page · raw message

app/test-pmd/config.c +6 -0
index d93699b34e3a..873a29a123a5 100644
@@ -3685,6 +3685,12 @@ set_record_core_cycles(uint8_t on_off)
 	record_core_cycles = on_off;
 }
 
+void
+set_record_burst_stats(uint8_t on_off)
+{
+	record_burst_stats = on_off;
+}
+
 static inline void
 print_fdir_mask(struct rte_eth_fdir_masks *mask)
 {
app/test-pmd/csumonly.c +2 -6
index 836bafa0f6df..7ece398bd462 100644
@@ -796,9 +796,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
 	/* receive a burst of packet */
 	nb_rx = rte_eth_rx_burst(fs->rx_port, fs->rx_queue, pkts_burst,
 				 nb_pkt_per_burst);
-#ifdef RTE_TEST_PMD_RECORD_BURST_STATS
-	fs->rx_burst_stats.pkt_burst_spread[nb_rx]++;
-#endif
+	inc_rx_burst_stats(fs, nb_rx);
 	if (unlikely(nb_rx == 0))
 		return;
 
@@ -1082,9 +1080,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
 	fs->rx_bad_l4_csum += rx_bad_l4_csum;
 	fs->rx_bad_outer_l4_csum += rx_bad_outer_l4_csum;
 
-#ifdef RTE_TEST_PMD_RECORD_BURST_STATS
-	fs->tx_burst_stats.pkt_burst_spread[nb_tx]++;
-#endif
+	inc_tx_burst_stats(fs, nb_tx);
 	if (unlikely(nb_tx < nb_rx)) {
 		fs->fwd_dropped += (nb_rx - nb_tx);
 		do {
app/test-pmd/flowgen.c +1 -3
index e92a0eeca254..acf3e24605eb 100644
@@ -188,9 +188,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs)
 	}
 	fs->tx_packets += nb_tx;
 
-#ifdef RTE_TEST_PMD_RECORD_BURST_STATS
-	fs->tx_burst_stats.pkt_burst_spread[nb_tx]++;
-#endif
+	inc_tx_burst_stats(fs, nb_tx);
 	if (unlikely(nb_tx < nb_pkt)) {
 		/* Back out the flow counter. */
 		next_flow -= (nb_pkt - nb_tx);
app/test-pmd/icmpecho.c +2 -6
index 3f27e8c29d33..af6f7e7902e4 100644
@@ -302,9 +302,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs)
 	 */
 	nb_rx = rte_eth_rx_burst(fs->rx_port, fs->rx_queue, pkts_burst,
 				 nb_pkt_per_burst);
-#ifdef RTE_TEST_PMD_RECORD_BURST_STATS
-	fs->rx_burst_stats.pkt_burst_spread[nb_rx]++;
-#endif
+	inc_rx_burst_stats(fs, nb_rx);
 	if (unlikely(nb_rx == 0))
 		return;
 
@@ -503,9 +501,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs)
 			}
 		}
 		fs->tx_packets += nb_tx;
-#ifdef RTE_TEST_PMD_RECORD_BURST_STATS
-		fs->tx_burst_stats.pkt_burst_spread[nb_tx]++;
-#endif
+		inc_tx_burst_stats(fs, nb_tx);
 		if (unlikely(nb_tx < nb_replies)) {
 			fs->fwd_dropped += (nb_replies - nb_tx);
 			do {
app/test-pmd/iofwd.c +2 -6
index 456f7b5925ed..83d098adcbf5 100644
@@ -59,9 +59,7 @@ pkt_burst_io_forward(struct fwd_stream *fs)
 	 */
 	nb_rx = rte_eth_rx_burst(fs->rx_port, fs->rx_queue,
 			pkts_burst, nb_pkt_per_burst);
-#ifdef RTE_TEST_PMD_RECORD_BURST_STATS
-	fs->rx_burst_stats.pkt_burst_spread[nb_rx]++;
-#endif
+	inc_rx_burst_stats(fs, nb_rx);
 	if (unlikely(nb_rx == 0))
 		return;
 	fs->rx_packets += nb_rx;
@@ -80,9 +78,7 @@ pkt_burst_io_forward(struct fwd_stream *fs)
 		}
 	}
 	fs->tx_packets += nb_tx;
-#ifdef RTE_TEST_PMD_RECORD_BURST_STATS
-	fs->tx_burst_stats.pkt_burst_spread[nb_tx]++;
-#endif
+	inc_tx_burst_stats(fs, nb_tx);
 	if (unlikely(nb_tx < nb_rx)) {
 		fs->fwd_dropped += (nb_rx - nb_tx);
 		do {
app/test-pmd/macfwd.c +2 -6
index 6a77568c7e60..0568ea794d48 100644
@@ -65,9 +65,7 @@ pkt_burst_mac_forward(struct fwd_stream *fs)
 	 */
 	nb_rx = rte_eth_rx_burst(fs->rx_port, fs->rx_queue, pkts_burst,
 				 nb_pkt_per_burst);
-#ifdef RTE_TEST_PMD_RECORD_BURST_STATS
-	fs->rx_burst_stats.pkt_burst_spread[nb_rx]++;
-#endif
+	inc_rx_burst_stats(fs, nb_rx);
 	if (unlikely(nb_rx == 0))
 		return;
 
@@ -111,9 +109,7 @@ pkt_burst_mac_forward(struct fwd_stream *fs)
 	}
 
 	fs->tx_packets += nb_tx;
-#ifdef RTE_TEST_PMD_RECORD_BURST_STATS
-	fs->tx_burst_stats.pkt_burst_spread[nb_tx]++;
-#endif
+	inc_tx_burst_stats(fs, nb_tx);
 	if (unlikely(nb_tx < nb_rx)) {
 		fs->fwd_dropped += (nb_rx - nb_tx);
 		do {
app/test-pmd/macswap.c +2 -6
index aaef5b0047b1..74e2dd838dd5 100644
@@ -66,9 +66,7 @@ pkt_burst_mac_swap(struct fwd_stream *fs)
 	 */
 	nb_rx = rte_eth_rx_burst(fs->rx_port, fs->rx_queue, pkts_burst,
 				 nb_pkt_per_burst);
-#ifdef RTE_TEST_PMD_RECORD_BURST_STATS
-	fs->rx_burst_stats.pkt_burst_spread[nb_rx]++;
-#endif
+	inc_rx_burst_stats(fs, nb_rx);
 	if (unlikely(nb_rx == 0))
 		return;
 
@@ -90,9 +88,7 @@ pkt_burst_mac_swap(struct fwd_stream *fs)
 		}
 	}
 	fs->tx_packets += nb_tx;
-#ifdef RTE_TEST_PMD_RECORD_BURST_STATS
-	fs->tx_burst_stats.pkt_burst_spread[nb_tx]++;
-#endif
+	inc_tx_burst_stats(fs, nb_tx);
 	if (unlikely(nb_tx < nb_rx)) {
 		fs->fwd_dropped += (nb_rx - nb_tx);
 		do {
app/test-pmd/parameters.c +6 -1
index 76072ae81b93..784515314ebd 100644
@@ -70,7 +70,8 @@ usage(char* progname)
 	       "--rxpt= | --rxht= | --rxwt= | --rxfreet= | "
 	       "--txpt= | --txht= | --txwt= | --txfreet= | "
 	       "--txrst= | --tx-offloads= | | --rx-offloads= | "
-	       "--vxlan-gpe-port= | --record-core-cycles]\n",
+	       "--vxlan-gpe-port= | --record-core-cycles | "
+	       "--record-burst-stats]\n",
 	       progname);
 #ifdef RTE_LIBRTE_CMDLINE
 	printf("  --interactive: run in interactive mode.\n");
@@ -217,6 +218,7 @@ usage(char* progname)
 	printf("  --rx-mq-mode=0xX: hexadecimal bitmask of RX mq mode can be "
 	       "enabled\n");
 	printf("  --record-core-cycles: enable measurement of CPU cycles.\n");
+	printf("  --record-burst-stats: enable display of RX and TX bursts.\n");
 }
 
 #ifdef RTE_LIBRTE_CMDLINE
@@ -679,6 +681,7 @@ launch_args_parse(int argc, char** argv)
 		{ "no-iova-contig",             0, 0, 0 },
 		{ "rx-mq-mode",                 1, 0, 0 },
 		{ "record-core-cycles",         0, 0, 0 },
+		{ "record-burst-stats",         0, 0, 0 },
 		{ 0, 0, 0, 0 },
 	};
 
@@ -1385,6 +1388,8 @@ launch_args_parse(int argc, char** argv)
 			}
 			if (!strcmp(lgopts[opt_idx].name, "record-core-cycles"))
 				record_core_cycles = 1;
+			if (!strcmp(lgopts[opt_idx].name, "record-burst-stats"))
+				record_burst_stats = 1;
 			break;
 		case 'h':
 			usage(argv[0]);
app/test-pmd/rxonly.c +1 -3
index b6c8b8c7d5db..c78fc4609ae5 100644
@@ -58,9 +58,7 @@ pkt_burst_receive(struct fwd_stream *fs)
 	 */
 	nb_rx = rte_eth_rx_burst(fs->rx_port, fs->rx_queue, pkts_burst,
 				 nb_pkt_per_burst);
-#ifdef RTE_TEST_PMD_RECORD_BURST_STATS
-	fs->rx_burst_stats.pkt_burst_spread[nb_rx]++;
-#endif
+	inc_rx_burst_stats(fs, nb_rx);
 	if (unlikely(nb_rx == 0))
 		return;
 
app/test-pmd/testpmd.c +17 -16
index f327b16604d2..fb286b86e51b 100644
@@ -480,6 +480,11 @@ uint8_t xstats_hide_zero;
  */
 uint8_t record_core_cycles;
 
+/*
+ * Display of RX and TX bursts disabled by default
+ */
+uint8_t record_burst_stats;
+
 unsigned int num_sockets = 0;
 unsigned int socket_ids[RTE_MAX_NUMA_NODES];
 
@@ -1684,7 +1689,6 @@ init_fwd_streams(void)
 	return 0;
 }
 
-#ifdef RTE_TEST_PMD_RECORD_BURST_STATS
 static void
 pkt_burst_stats_display(const char *rx_tx, struct pkt_burst_stats *pbs)
 {
@@ -1751,7 +1755,6 @@ pkt_burst_stats_display(const char *rx_tx, struct pkt_burst_stats *pbs)
 		sburstp += burst_percent[i];
 	}
 }
-#endif /* RTE_TEST_PMD_RECORD_BURST_STATS */
 
 static void
 fwd_stream_stats_display(streamid_t stream_id)
@@ -1782,10 +1785,10 @@ fwd_stream_stats_display(streamid_t stream_id)
 		printf("\n");
 	}
 
-#ifdef RTE_TEST_PMD_RECORD_BURST_STATS
-	pkt_burst_stats_display("RX", &fs->rx_burst_stats);
-	pkt_burst_stats_display("TX", &fs->tx_burst_stats);
-#endif
+	if (record_burst_stats) {
+		pkt_burst_stats_display("RX", &fs->rx_burst_stats);
+		pkt_burst_stats_display("TX", &fs->tx_burst_stats);
+	}
 }
 
 void
@@ -1915,14 +1918,14 @@ fwd_stats_display(void)
 			       stats.opackets + ports_stats[pt_id].tx_dropped);
 		}
 
-#ifdef RTE_TEST_PMD_RECORD_BURST_STATS
-		if (ports_stats[pt_id].rx_stream)
-			pkt_burst_stats_display("RX",
-				&ports_stats[pt_id].rx_stream->rx_burst_stats);
-		if (ports_stats[pt_id].tx_stream)
-			pkt_burst_stats_display("TX",
-				&ports_stats[pt_id].tx_stream->tx_burst_stats);
-#endif
+		if (record_burst_stats) {
+			if (ports_stats[pt_id].rx_stream)
+				pkt_burst_stats_display("RX",
+					&ports_stats[pt_id].rx_stream->rx_burst_stats);
+			if (ports_stats[pt_id].tx_stream)
+				pkt_burst_stats_display("TX",
+					&ports_stats[pt_id].tx_stream->tx_burst_stats);
+		}
 
 		if (port->rx_queue_stats_mapping_enabled) {
 			printf("\n");
@@ -2004,10 +2007,8 @@ fwd_stats_reset(void)
 		fs->rx_bad_l4_csum = 0;
 		fs->rx_bad_outer_l4_csum = 0;
 
-#ifdef RTE_TEST_PMD_RECORD_BURST_STATS
 		memset(&fs->rx_burst_stats, 0, sizeof(fs->rx_burst_stats));
 		memset(&fs->tx_burst_stats, 0, sizeof(fs->tx_burst_stats));
-#endif
 		fs->core_cycles = 0;
 	}
 }
app/test-pmd/testpmd.h +16 -4
index dcc37be02d59..a8ae5cceb198 100644
@@ -76,7 +76,6 @@ enum {
 	/**< allocate mempool natively, use rte_pktmbuf_pool_create_extbuf */
 };
 
-#ifdef RTE_TEST_PMD_RECORD_BURST_STATS
 /**
  * The data structure associated with RX and TX packet burst statistics
  * that are recorded for each forwarding stream.
@@ -84,7 +83,6 @@ enum {
 struct pkt_burst_stats {
 	unsigned int pkt_burst_spread[MAX_PKT_BURST];
 };
-#endif
 
 /** Information for a given RSS type. */
 struct rss_type_info {
@@ -130,10 +128,8 @@ struct fwd_stream {
 	/**< received packets has bad outer l4 checksum */
 	unsigned int gro_times;	/**< GRO operation times */
 	uint64_t     core_cycles; /**< used for RX and TX processing */
-#ifdef RTE_TEST_PMD_RECORD_BURST_STATS
 	struct pkt_burst_stats rx_burst_stats;
 	struct pkt_burst_stats tx_burst_stats;
-#endif
 };
 
 /** Descriptor for a single flow. */
@@ -300,6 +296,7 @@ extern uint8_t xstats_hide_zero; /**< Hide zero values for xstats display */
 
 /* globals used for configuration */
 extern uint8_t record_core_cycles; /**< Enables measurement of CPU cycles */
+extern uint8_t record_burst_stats; /**< Enables display of RX and TX bursts */
 extern uint16_t verbose_level; /**< Drives messages being displayed, if any. */
 extern int testpmd_logtype; /**< Log type for testpmd logs */
 extern uint8_t  interactive;
@@ -694,6 +691,20 @@ get_end_cycles(struct fwd_stream *fs, uint64_t start_tsc)
 		fs->core_cycles += rte_rdtsc() - start_tsc;
 }
 
+static inline void
+inc_rx_burst_stats(struct fwd_stream *fs, uint16_t nb_rx)
+{
+	if (record_burst_stats)
+		fs->rx_burst_stats.pkt_burst_spread[nb_rx]++;
+}
+
+static inline void
+inc_tx_burst_stats(struct fwd_stream *fs, uint16_t nb_tx)
+{
+	if (record_burst_stats)
+		fs->tx_burst_stats.pkt_burst_spread[nb_tx]++;
+}
+
 /* Prototypes */
 unsigned int parse_item_list(char* str, const char* item_name,
 			unsigned int max_items,
@@ -786,6 +797,7 @@ void set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id, uint8_t map_va
 void set_xstats_hide_zero(uint8_t on_off);
 
 void set_record_core_cycles(uint8_t on_off);
+void set_record_burst_stats(uint8_t on_off);
 void set_verbose_level(uint16_t vb_level);
 void set_tx_pkt_segments(unsigned *seg_lengths, unsigned nb_segs);
 void show_tx_pkt_segments(void);
app/test-pmd/txonly.c +1 -3
index 00a3a6f90c7a..7d4f105ccd68 100644
@@ -369,9 +369,7 @@ pkt_burst_transmit(struct fwd_stream *fs)
 	if (txonly_multi_flow)
 		RTE_PER_LCORE(_ip_var) -= nb_pkt - nb_tx;
 
-#ifdef RTE_TEST_PMD_RECORD_BURST_STATS
-	fs->tx_burst_stats.pkt_burst_spread[nb_tx]++;
-#endif
+	inc_tx_burst_stats(fs, nb_tx);
 	if (unlikely(nb_tx < nb_pkt)) {
 		if (verbose_level > 0 && fs->fwd_dropped == 0)
 			printf("port %d tx_queue %d - drop "
Signature · 1 line
2.17.1
#40 lore raw

PATCH 4/6 doc: add record-burst-stats to testpmd funcs doc

In reply to Dharmik Thakkar

Update documentation to include description of 'record-burst-stats' runtime configuration.

---
 doc/guides/testpmd_app_ug/run_app.rst       |  2 ++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 15 +++++++++++++++
 2 files changed, 17 insertions(+)
doc/guides/testpmd_app_ug/run_app.rst +2 -0
index 2b8e0ad69157..e2539f693f66 100644
@@ -494,4 +494,6 @@ The command line options are:
 
     Enable measurement of CPU cycles per packet.
 
+*   ``--record-burst-stats``
 
+    Enable display of RX and TX burst stats.
doc/guides/testpmd_app_ug/testpmd_funcs.rst +15 -0
index 980bf3340763..2192a7e4720d 100644
@@ -725,6 +725,21 @@ Where:
 
 This is equivalent to the ``--record-core-cycles command-line`` option.
 
+set record-burst-stats
+~~~~~~~~~~~~~~~~~~~~~~
+
+Set the displaying of RX and TX bursts::
+
+   testpmd> set record-burst-stats (on|off)
+
+Where:
+
+* ``on`` enables display of RX and TX bursts.
+
+* ``off`` disables display of RX and TX bursts.
+
+This is equivalent to the ``--record-burst-stats command-line`` option.
+
 set burst
 ~~~~~~~~~
 
Signature · 1 line
2.17.1
#41 lore raw

PATCH 5/6 app/testpmd: enable burst stats for noisy vnf mode

In reply to Dharmik Thakkar

From: Phil Yang <[email protected]>

Add burst stats for noisy vnf mode.

Fixes 3c156061b938 ("app/testpmd: add noisy neighbour forwarding mode")
---
 app/test-pmd/noisy_vnf.c | 4 ++++
 1 file changed, 4 insertions(+)
app/test-pmd/noisy_vnf.c +4 -0
index 58c4ee925566..382a4c2aaef1 100644
@@ -154,6 +154,7 @@ pkt_burst_noisy_vnf(struct fwd_stream *fs)
 
 	nb_rx = rte_eth_rx_burst(fs->rx_port, fs->rx_queue,
 			pkts_burst, nb_pkt_per_burst);
+	inc_rx_burst_stats(fs, nb_rx);
 	if (unlikely(nb_rx == 0))
 		goto flush;
 	fs->rx_packets += nb_rx;
@@ -164,6 +165,7 @@ pkt_burst_noisy_vnf(struct fwd_stream *fs)
 				pkts_burst, nb_rx);
 		if (unlikely(nb_tx < nb_rx) && fs->retry_enabled)
 			nb_tx += do_retry(nb_rx, nb_tx, pkts_burst, fs);
+		inc_tx_burst_stats(fs, nb_tx);
 		fs->tx_packets += nb_tx;
 		fs->fwd_dropped += drop_pkts(pkts_burst, nb_rx, nb_tx);
 		return;
@@ -187,6 +189,7 @@ pkt_burst_noisy_vnf(struct fwd_stream *fs)
 					nb_deqd);
 			if (unlikely(nb_tx < nb_rx) && fs->retry_enabled)
 				nb_tx += do_retry(nb_rx, nb_tx, tmp_pkts, fs);
+			inc_tx_burst_stats(fs, nb_tx);
 			fs->fwd_dropped += drop_pkts(tmp_pkts, nb_deqd, nb_tx);
 		}
 	}
@@ -211,6 +214,7 @@ pkt_burst_noisy_vnf(struct fwd_stream *fs)
 					 tmp_pkts, nb_deqd);
 		if (unlikely(sent < nb_deqd) && fs->retry_enabled)
 			nb_tx += do_retry(nb_rx, nb_tx, tmp_pkts, fs);
+		inc_tx_burst_stats(fs, nb_tx);
 		fs->fwd_dropped += drop_pkts(tmp_pkts, nb_deqd, sent);
 		ncf->prev_time = rte_get_timer_cycles();
 	}
Signature · 1 line
2.17.1
#42 lore raw

PATCH 6/6 app/testpmd: enable empty polls in 5tswap

In reply to Dharmik Thakkar

Enable empty polls in burst stats within 5tswap.c

---
 app/test-pmd/5tswap.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
app/test-pmd/5tswap.c +1 -2
index d9026ce86556..3cf1692eaba8 100644
@@ -114,11 +114,10 @@ pkt_burst_5tuple_swap(struct fwd_stream *fs)
 	 */
 	nb_rx = rte_eth_rx_burst(fs->rx_port, fs->rx_queue, pkts_burst,
 				 nb_pkt_per_burst);
+	inc_rx_burst_stats(fs, nb_rx);
 	if (unlikely(nb_rx == 0))
 		return;
 
-	inc_rx_burst_stats(fs, nb_rx);
-
 	fs->rx_packets += nb_rx;
 	txp = &ports[fs->tx_port];
 	ol_flags = ol_flags_init(txp->dev_conf.txmode.offloads);
Signature · 1 line
2.17.1
Reviewed-by on v1 6/6
#43 lore raw

Re: [dpdk-dev] [PATCH 6/6] app/testpmd: enable empty polls in 5tswap

Quoted 9 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Dharmik Thakkar
Sent: Wednesday, July 15, 2020 5:51 AM
To: Wenzhuo Lu <[email protected]>; Beilei Xing <[email protected]>; Bernard Iremonger <[email protected]>
Cc: [email protected]; nd <[email protected]>; Dharmik Thakkar <[email protected]>
Subject: [dpdk-dev] [PATCH 6/6] app/testpmd: enable empty polls in 5tswap

Quoted 4 lines

Enable empty polls in burst stats within 5tswap.c

#44 lore raw

Re: [dpdk-dev] [PATCH 0/6] app/testpmd: add runtime config

In reply to Dharmik Thakkar
Quoted 7 lines · Dharmik Thakkar

Meson build system lacks support for CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES and CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS configuration options.

One solution is to add these options within meson_options.txt

Since adding these as runtime config causes no performance impact,

Hi Dharmik,

These are on the datapath, and even disable there will be additional checks, isn't it expected to have some impact?
Did you do any measurements for it?

Quoted 2 lines

it makes sense to enable these as runtime config alongside other available runtime options within testpmd.

If there is performance impact,
another option can be still using the compile time config with meson. As Jerin suggested previously, or Ed is doing in his patch right now, something like:

#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
const int record_core_cycles = 1;
#else
const int record_core_cycles = 0;
#endif

static inline void
get_start_cycles(uint64_t *start_tsc)
{
if (record_core_cycles)
*start_tsc = rte_rdtsc();
}

When meson compiled by default, compiler will optimize out the code during compile time.

To enable it, can provide the config option with CFLAGS, CFLAGS="-DRTE_TEST_PMD_RECORD_CORE_CYCLES" meson build

Quoted 30 lines

Dharmik Thakkar (5):
app/testpmd: add record-core-cycles runtime config
doc: add record-core-cycles to testpmd funcs doc app/testpmd: add record-burst-stats runtime config
doc: add record-burst-stats to testpmd funcs doc app/testpmd: enable empty polls in 5tswap

Phil Yang (1):
app/testpmd: enable burst stats for noisy vnf mode

 app/test-pmd/5tswap.c                       | 25 ++----
 app/test-pmd/cmdline.c                      | 92 +++++++++++++++++++++
 app/test-pmd/config.c                       | 12 +++
 app/test-pmd/csumonly.c                     | 24 ++----
 app/test-pmd/flowgen.c                      | 21 ++---
 app/test-pmd/icmpecho.c                     | 24 ++----
 app/test-pmd/iofwd.c                        | 26 ++----
 app/test-pmd/macfwd.c                       | 25 ++----
 app/test-pmd/macswap.c                      | 24 ++----
 app/test-pmd/noisy_vnf.c                    |  4 +
 app/test-pmd/parameters.c                   | 11 ++-
 app/test-pmd/rxonly.c                       | 19 +----
 app/test-pmd/testpmd.c                      | 77 ++++++++---------
 app/test-pmd/testpmd.h                      | 38 +++++++--
 app/test-pmd/txonly.c                       | 20 +----
 doc/guides/testpmd_app_ug/run_app.rst       |  8 ++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 30 +++++++
 17 files changed, 272 insertions(+), 208 deletions(-)
#45 lore raw

Re: [dpdk-dev] [PATCH 0/6] app/testpmd: add runtime config

Quoted 7 lines · Ferruh Yigit
Quoted 6 lines · Dharmik Thakkar

Meson build system lacks support for CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES and CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS configuration options.

One solution is to add these options within meson_options.txt

Quoted 8 lines
Quoted 1 line

Since adding these as runtime config causes no performance impact,

Hi Dharmik,

These are on the datapath, and even disable there will be additional checks, isn't it expected to have some impact? Did you do any measurements for it?

Branches that always predict the same way can be very cheap, and unless proven to be a problem, I'd see no issue with having a few on the datapath
- especially if it just one or two per burst. If we start seeing a significant number, or ones that occur for every packet, then we perhaps need to be more cautious.

I also think that using lots of different CFLAGS for turning things on and off is as bad - or even worse - than using the old build-time config options, just this time we don't have a single list of them somewhere! Therefore, I think we really need to start converting these to runtime options where we can.

Regards,
/Bruce

#46 lore raw

Re: [dpdk-dev] [PATCH 0/6] app/testpmd: add runtime config

Quoted 12 lines · Bruce Richardson
Quoted 7 lines · Ferruh Yigit
Quoted 6 lines · Dharmik Thakkar

Meson build system lacks support for CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES and CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS configuration options.

One solution is to add these options within meson_options.txt

Quoted 7 lines
Quoted 7 lines
Quoted 1 line

Since adding these as runtime config causes no performance impact,

Hi Dharmik,

These are on the datapath, and even disable there will be additional checks, isn't it expected to have some impact? Did you do any measurements for it?

Hi Ferruh,

In my measurements, I saw a maximum performance degradation of 0.3% for rx and tx throughput (pps) with runtime option (both disabled and enabled cases) when compared to compile time option.. There was no difference in cycles per packet measurement.
I did these measurements with Mellanox-ConnectX-5 card on N1SDP server with ’set fwd mac retry’ option.

Quoted 15 lines
Quoted 1 line

Branches that always predict the same way can be very cheap, and unless proven to be a problem, I'd see no issue with having a few on the datapath
- especially if it just one or two per burst. If we start seeing a significant number, or ones that occur for every packet, then we perhaps need to be more cautious.

I also think that using lots of different CFLAGS for turning things on and off is as bad - or even worse - than using the old build-time config options, just this time we don't have a single list of them somewhere! Therefore, I think we really need to start converting these to runtime options where we can.

Regards,
/Bruce

#47 lore raw

Re: [dpdk-dev] [PATCH 0/6] app/testpmd: add runtime config

Quoted 20 lines · Dharmik Thakkar
Quoted 12 lines · Bruce Richardson
Quoted 7 lines · Ferruh Yigit
Quoted 6 lines · Dharmik Thakkar

Meson build system lacks support for CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES and CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS configuration options.

One solution is to add these options within meson_options.txt

Quoted 7 lines
Quoted 7 lines
Quoted 1 line

Since adding these as runtime config causes no performance impact,

Hi Dharmik,

These are on the datapath, and even disable there will be additional checks, isn't it expected to have some impact? Did you do any measurements for it?

Quoted 7 lines

Hi Ferruh,

In my measurements, I saw a maximum performance degradation of 0.3% for rx and tx throughput (pps) with runtime option (both disabled and enabled cases) when compared to compile time option.. There was no difference in cycles per packet measurement.
I did these measurements with Mellanox-ConnectX-5 card on N1SDP server with ’set fwd mac retry’ option.

Thanks Dharmik,

0.3% does not look a lot, I also don't get any recognizable drop when the stats are disabled (there is a drop (up to %15) when stats are enabled but that is OK). And there is a benefit to have the stats runtime configurable.

This minor drop for runtime configuration looks OK to me, but lets wait a little more if there is any strong objection to it, we can proceed afterwards.

Quoted 19 lines
Quoted 16 lines
Quoted 2 lines

Branches that always predict the same way can be very cheap, and unless proven to be a problem, I'd see no issue with having a few on the datapath
- especially if it just one or two per burst. If we start seeing a significant number, or ones that occur for every packet, then we perhaps need to be more cautious.

I also think that using lots of different CFLAGS for turning things on and off is as bad - or even worse - than using the old build-time config options, just this time we don't have a single list of them somewhere! Therefore, I think we really need to start converting these to runtime options where we can.

Regards,
/Bruce

Reviewed-by
#48 lore raw

Re: [dpdk-dev] [PATCH 0/6] app/testpmd: add runtime config

Quoted 29 lines · Ferruh Yigit
Quoted 20 lines · Dharmik Thakkar
Quoted 12 lines · Bruce Richardson
Quoted 7 lines · Ferruh Yigit
Quoted 6 lines · Dharmik Thakkar

Meson build system lacks support for CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES and CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS configuration options.

One solution is to add these options within meson_options.txt

Quoted 7 lines
Quoted 7 lines
Quoted 1 line

Since adding these as runtime config causes no performance impact,

Hi Dharmik,

These are on the datapath, and even disable there will be additional checks, isn't it expected to have some impact? Did you do any measurements for it?

Quoted 7 lines

Hi Ferruh,

In my measurements, I saw a maximum performance degradation of 0.3% for rx and tx throughput (pps) with runtime option (both disabled and enabled cases) when compared to compile time option.. There was no difference in cycles per packet measurement.
I did these measurements with Mellanox-ConnectX-5 card on N1SDP server with ’set fwd mac retry’ option.

Quoted 8 lines

Thanks Dharmik,

0.3% does not look a lot, I also don't get any recognizable drop when the stats are disabled (there is a drop (up to %15) when stats are enabled but that is OK). And there is a benefit to have the stats runtime configurable.

This minor drop for runtime configuration looks OK to me, but lets wait a little more if there is any strong objection to it, we can proceed afterwards.

There seems no objection to switching runtime configuration.

For series,

Series applied to dpdk-next-net/main, thanks.
(doc patches merged to the code while merging.)

#49 lore raw

Re: [dpdk-dev] [PATCH 0/6] app/testpmd: add runtime config

In reply to Bruce Richardson
Quoted 22 lines · Bruce Richardson
Quoted 7 lines · Ferruh Yigit
Quoted 6 lines · Dharmik Thakkar

Meson build system lacks support for CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES and CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS configuration options.

One solution is to add these options within meson_options.txt

Quoted 8 lines
Quoted 1 line

Since adding these as runtime config causes no performance impact,

Hi Dharmik,

These are on the datapath, and even disable there will be additional checks, isn't it expected to have some impact? Did you do any measurements for it?

Branches that always predict the same way can be very cheap, and unless proven to be a problem, I'd see no issue with having a few on the datapath
- especially if it just one or two per burst. If we start seeing a significant number, or ones that occur for every packet, then we perhaps need to be more cautious.

Quoted 5 lines

I also think that using lots of different CFLAGS for turning things on and off is as bad - or even worse - than using the old build-time config options, just this time we don't have a single list of them somewhere! Therefore, I think we really need to start converting these to runtime options where we can.

+1 using config options via 'CFLAGS' is worse. But if we want it to be compile time option because of performance, this is an option.

Applied
#51 lore raw

Re: [dpdk-dev] [PATCH v3 1/2] doc: add cycles per packet in testpmd user guide

Quoted 10 lines · Ferruh Yigit
Quoted 6 lines · Dharmik Thakkar

Update documentation for 'show fwd' testpmd runtime function to show CPU cycles/packet example.

Applied to dpdk-next-net/master, thanks.

(note that not all patches in the patchset applied, only 1/2 applied)

#52 lore raw

PATCH v2 4/5 doc: include config options in testpmd user guide

In reply to Dharmik Thakkar

Update testpmd documentation to include RECORD configuration options, CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES and CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS.

---
v2:
- Remove extra '#'.

---
 doc/guides/testpmd_app_ug/build_app.rst | 12 ++++++++++++
 1 file changed, 12 insertions(+)
doc/guides/testpmd_app_ug/build_app.rst +12 -0
index d1ca9f3d19a9..b93c82b8c115 100644
@@ -21,6 +21,18 @@ The basic compilation steps are:
 
         export RTE_TARGET=x86_64-native-linux-gcc
 
+#.  If required, enable configuration options. For example:
+
+    .. code-block:: console
+
+        cd to the top-level DPDK directory
+        sed -i 's,\(CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES\)=n,\1=y,' config/common_base
+        sed -i 's,\(CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS\)=n,\1=y,' config/common_base
+
+    Enabling CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES enables measurement of CPU cycles.
+
+    Enabling CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS enables display of RX and TX bursts.
+
 #.  Build the application:
 
     .. code-block:: console
Signature · 1 line
2.20.1
Acked-by on v2 4/5
#53 lore raw

Re: [dpdk-dev] [PATCH v2 4/5] doc: include config options in testpmd user guide

Quoted 12 lines

-----Original Message-----
From: Dharmik Thakkar <[email protected]>
Sent: Friday, May 8, 2020 11:38 PM
To: Lu, Wenzhuo <[email protected]>; Wu, Jingjing <[email protected]>; Iremonger, Bernard <[email protected]>; Mcnamara, John <[email protected]>; Kovacevic, Marko <[email protected]>
Cc: [email protected]; [email protected]; Dharmik Thakkar <[email protected]>
Subject: [PATCH v2 4/5] doc: include config options in testpmd user guide

Quoted 7 lines

Update testpmd documentation to include RECORD configuration options, CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES and CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS.

#54 lore raw

Re: [dpdk-dev] [PATCH v2 4/5] doc: include config options in testpmd user guide

Quoted 9 lines
Quoted 7 lines

Update testpmd documentation to include RECORD configuration options, CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES and CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS.

How these options are managed with meson?

#55 lore raw

Re: [dpdk-dev] [PATCH v2 4/5] doc: include config options in testpmd user guide

Quoted 8 lines · Thomas Monjalon
Quoted 5 lines
Quoted 5 lines

Update testpmd documentation to include RECORD configuration options, CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES and CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS.

Quoted 9 lines
Quoted 5 lines
Quoted 3 lines

How these options are managed with meson?

As per my understanding, currently, this is not implemented with meson.
With ‘make’, the configuration options are saved within ./build/include/rte_config.h ( which gets generated during make config …). But this file (rte_config.h) does not get generated when using meson.

#56 lore raw

Re: [dpdk-dev] [PATCH v2 4/5] doc: include config options in testpmd user guide

20/05/2020 00:58, Dharmik Thakkar:

Quoted 9 lines
Quoted 9 lines · Thomas Monjalon
Quoted 8 lines
Quoted 7 lines

Update testpmd documentation to include RECORD configuration options, CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES and CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

How these options are managed with meson?

As per my understanding, currently, this is not implemented with meson.
With ‘make’, the configuration options are saved within ./build/include/rte_config.h ( which gets generated during make config …). But this file (rte_config.h) does not get generated when using meson.

That's also my understanding.
There is a gap which needs to be fixed, not sure what is the best approach. Can it be made a runtime option?

#57 lore raw

Re: [dpdk-dev] [PATCH v2 4/5] doc: include config options in testpmd user guide

Quoted 16 lines · Thomas Monjalon

20/05/2020 00:58, Dharmik Thakkar:

Quoted 11 lines
Quoted 11 lines · Thomas Monjalon
Quoted 9 lines
Quoted 7 lines

Update testpmd documentation to include RECORD configuration options, CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES and CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

How these options are managed with meson?

As per my understanding, currently, this is not implemented with meson.
With ‘make’, the configuration options are saved within ./build/include/rte_config.h ( which gets generated during make config …). But this file (rte_config.h) does not get generated when using meson.

That's also my understanding.
There is a gap which needs to be fixed, not sure what is the best approach.

IMO, for now, it is best to replicate what is being done for ‘make’.

Quoted 1 line

Can it be made a runtime option?

Yes, it can be made a runtime option but that will be a separate patch.

Quoted 1 line
#58 lore raw

Re: [dpdk-dev] [PATCH v2 4/5] doc: include config options in testpmd user guide

In reply to Dharmik Thakkar

09/05/2020 00:38, Dharmik Thakkar:

Quoted 8 lines

Update testpmd documentation to include RECORD configuration options, CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES and CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS.

---

doc/guides/testpmd_app_ug/build_app.rst The basic compilation steps are: · line 30

Quoted 7 lines
doc/guides/testpmd_app_ug/build_app.rst +7 -0
+#.  If required, enable configuration options. For example:
+
+    .. code-block:: console
+
+        cd to the top-level DPDK directory
+        sed -i 's,\(CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES\)=n,\1=y,' config/common_base
+        sed -i 's,\(CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS\)=n,\1=y,' config/common_base

Changing source code is wrong.
Only the generated .config file should be changed.

Not even speaking about meson...

Why we don't have any review on documentation patches?

Patch dropped from next-net pulling.

#59 lore raw

PATCH v2 5/5 doc: add aarch64 generic counter section

In reply to Dharmik Thakkar

Add a separate section for low-resolution generic counter for ARM64 profiling methods.

---
v2:
- Add Acked-by tag

---
 doc/guides/prog_guide/profile_app.rst | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
doc/guides/prog_guide/profile_app.rst +8 -3
index a36ebef4db99..e5d0e9079e11 100644
@@ -57,11 +57,16 @@ For more derails refer to the
 `ARM64 specific PMU events enumeration <http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.100095_0002_04_en/way1382543438508.html>`_.
 
 
-High-resolution cycle counter
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Low-resolution generic counter
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 The default ``cntvct_el0`` based ``rte_rdtsc()`` provides a portable means to
-get a wall clock counter in user space. Typically it runs at <= 100MHz.
+get a wall clock counter in user space. Typically it runs at a lower clock frequency than the CPU clock frequency.
+Cycles counted using this method should be scaled to CPU clock frequency.
+
+
+High-resolution cycle counter
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 The alternative method to enable ``rte_rdtsc()`` for a high resolution wall
 clock counter is through the ARMv8 PMU subsystem. The PMU cycle counter runs
Signature · 1 line
2.20.1
Acked-by on v2 1/5
#60 lore raw
In reply to Dharmik Thakkar
Quoted 10 lines

-----Original Message-----
From: Dharmik Thakkar <[email protected]>
Sent: Friday, May 8, 2020 11:38 PM
To: Lu, Wenzhuo <[email protected]>; Wu, Jingjing <[email protected]>; Iremonger, Bernard <[email protected]>
Cc: [email protected]; [email protected]; Dharmik Thakkar <[email protected]>
Subject: [PATCH v2 1/5] app/testpmd: print clock with CPU cycles per pkt

Quoted 8 lines

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.

#61 lore raw
In reply to Dharmik Thakkar
Quoted 8 lines · Dharmik Thakkar

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.

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.