patches for DPDK stable branches
 help / color / Atom feed
* [dpdk-stable] [PATCH] app/testpmd: fix CPU cycles per pkt stats on transmit modes
@ 2020-06-18 14:50 Phil Yang
  2020-06-18 19:28 ` Honnappa Nagarahalli
  2020-06-19  4:08 ` [dpdk-stable] [PATCH v2] " Phil Yang
  0 siblings, 2 replies; 7+ messages in thread
From: Phil Yang @ 2020-06-18 14:50 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, maxime.coquelin, Honnappa.Nagarahalli,
	ruifeng.wang, nd, stable, david.marchand

In txonly and flowgen forwarding mode, calculating CPU per packets with
total received packets is not accurate. Use total transmitted packets
for these cases.

The error output under txonly mode:
testpmd> show fwd stats all

---------------------- Forward statistics for port 0  -------------------
RX-packets: 0              RX-dropped: 0             RX-total: 0
TX-packets: 3582891927     TX-dropped: 401965824     TX-total: 3984857751
TX-bursts : 86381636 [0% of 0 pkts + 85% of 64 pkts + 15% of 32 pkts]
-------------------------------------------------------------------------

---------------------- Forward statistics for port 1  -------------------
RX-packets: 1              RX-dropped: 394351696     RX-total: 394351697
TX-packets: 3582890632     TX-dropped: 401965568     TX-total: 3984856200
TX-bursts : 86381679 [0% of 0 pkts + 85% of 64 pkts + 15% of 32 pkts]
-------------------------------------------------------------------------

+++++++++++++++ Accumulated forward statistics for all ports+++++++++++++
RX-packets: 1              RX-dropped: 394351696     RX-total: 394351697
TX-packets: 7165782559     TX-dropped: 803931392     TX-total: 7969713951
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

CPU cycles/packet=54984156291.00 \
(total cycles=54984156291 / total RX packets=1) at 200 MHz Clock

Signed-off-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Fixes: 53324971a14e ("app/testpmd: display/clear forwarding stats on demand")
Cc: stable@dpdk.org
Cc: david.marchand@redhat.com
---
 app/test-pmd/testpmd.c | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 4989d22..798b8e0 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1961,13 +1961,23 @@ fwd_stats_display(void)
 	       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=%.2F (total cycles="
-		       "%"PRIu64" / total RX packets=%"PRIu64") at %"PRIu64
-		       " MHz Clock\n",
-		       (double) fwd_cycles / total_recv,
-		       fwd_cycles, total_recv,
-		       (uint64_t)(rte_get_tsc_hz() / CYC_PER_MHZ));
+	if (total_recv > 0 || total_xmit > 0) {
+		if (strcmp(cur_fwd_eng->fwd_mode_name, "txonly") == 0 ||
+		    strcmp(cur_fwd_eng->fwd_mode_name, "flowgen") == 0)
+			printf("\n  CPU cycles/packet=%.2F (total cycles="
+			     "%"PRIu64" / total %s packets=%"PRIu64") at %"
+			     PRIu64" MHz Clock\n",
+			     (double) fwd_cycles / total_xmit,
+			     fwd_cycles, cur_fwd_eng->fwd_mode_name, total_xmit,
+			     (uint64_t)(rte_get_tsc_hz() / CYC_PER_MHZ));
+		else
+			printf("\n  CPU cycles/packet=%.2F (total cycles="
+			    "%"PRIu64" / total %s packets=%"PRIu64") at %"
+			    PRIu64" MHz Clock\n",
+			    (double) fwd_cycles / total_recv,
+			    fwd_cycles, cur_fwd_eng->fwd_mode_name, total_recv,
+			    (uint64_t)(rte_get_tsc_hz() / CYC_PER_MHZ));
+	}
 #endif
 }
 
-- 
2.7.4


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-stable] [PATCH] app/testpmd: fix CPU cycles per pkt stats on transmit modes
  2020-06-18 14:50 [dpdk-stable] [PATCH] app/testpmd: fix CPU cycles per pkt stats on transmit modes Phil Yang
@ 2020-06-18 19:28 ` Honnappa Nagarahalli
  2020-06-19  3:54   ` Phil Yang
  2020-06-19  4:08 ` [dpdk-stable] [PATCH v2] " Phil Yang
  1 sibling, 1 reply; 7+ messages in thread
From: Honnappa Nagarahalli @ 2020-06-18 19:28 UTC (permalink / raw)
  To: Phil Yang, dev
  Cc: ferruh.yigit, maxime.coquelin, Ruifeng Wang, nd, stable,
	david.marchand, Honnappa Nagarahalli, nd

<snip>

> Subject: [PATCH] app/testpmd: fix CPU cycles per pkt stats on transmit modes
> 
> In txonly and flowgen forwarding mode, calculating CPU per packets with total
> received packets is not accurate. Use total transmitted packets for these cases.
> 
> The error output under txonly mode:
> testpmd> show fwd stats all
> 
> ---------------------- Forward statistics for port 0  -------------------
> RX-packets: 0              RX-dropped: 0             RX-total: 0
> TX-packets: 3582891927     TX-dropped: 401965824     TX-total: 3984857751
> TX-bursts : 86381636 [0% of 0 pkts + 85% of 64 pkts + 15% of 32 pkts]
> -------------------------------------------------------------------------
> 
> ---------------------- Forward statistics for port 1  -------------------
> RX-packets: 1              RX-dropped: 394351696     RX-total: 394351697
> TX-packets: 3582890632     TX-dropped: 401965568     TX-total: 3984856200
> TX-bursts : 86381679 [0% of 0 pkts + 85% of 64 pkts + 15% of 32 pkts]
> -------------------------------------------------------------------------
> 
> +++++++++++++++ Accumulated forward statistics for all
> +++++++++++++++ ports+++++++++++++
> RX-packets: 1              RX-dropped: 394351696     RX-total: 394351697
> TX-packets: 7165782559     TX-dropped: 803931392     TX-total: 7969713951
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> ++++++++
> 
> CPU cycles/packet=54984156291.00 \
> (total cycles=54984156291 / total RX packets=1) at 200 MHz Clock
> 
> Signed-off-by: Phil Yang <phil.yang@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> Fixes: 53324971a14e ("app/testpmd: display/clear forwarding stats on
> demand")
> Cc: stable@dpdk.org
> Cc: david.marchand@redhat.com
> ---
>  app/test-pmd/testpmd.c | 24 +++++++++++++++++-------
>  1 file changed, 17 insertions(+), 7 deletions(-)
> 
> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index
> 4989d22..798b8e0 100644
> --- a/app/test-pmd/testpmd.c
> +++ b/app/test-pmd/testpmd.c
> @@ -1961,13 +1961,23 @@ fwd_stats_display(void)
>  	       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=%.2F (total cycles="
> -		       "%"PRIu64" / total RX packets=%"PRIu64") at %"PRIu64
> -		       " MHz Clock\n",
> -		       (double) fwd_cycles / total_recv,
> -		       fwd_cycles, total_recv,
> -		       (uint64_t)(rte_get_tsc_hz() / CYC_PER_MHZ));
> +	if (total_recv > 0 || total_xmit > 0) {
> +		if (strcmp(cur_fwd_eng->fwd_mode_name, "txonly") == 0 ||
> +		    strcmp(cur_fwd_eng->fwd_mode_name, "flowgen") == 0)
> +			printf("\n  CPU cycles/packet=%.2F (total cycles="
> +			     "%"PRIu64" / total %s packets=%"PRIu64") at %"
> +			     PRIu64" MHz Clock\n",
> +			     (double) fwd_cycles / total_xmit,
> +			     fwd_cycles, cur_fwd_eng->fwd_mode_name,
> total_xmit,
> +			     (uint64_t)(rte_get_tsc_hz() / CYC_PER_MHZ));
> +		else
> +			printf("\n  CPU cycles/packet=%.2F (total cycles="
> +			    "%"PRIu64" / total %s packets=%"PRIu64") at %"
> +			    PRIu64" MHz Clock\n",
> +			    (double) fwd_cycles / total_recv,
> +			    fwd_cycles, cur_fwd_eng->fwd_mode_name,
> total_recv,
> +			    (uint64_t)(rte_get_tsc_hz() / CYC_PER_MHZ));
> +	}
nit. Only difference between the two 'printf' calls are total_recv vs total_xmit. Can be consolidated into a single printf.

>  #endif
>  }
> 
> --
> 2.7.4


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-stable] [PATCH] app/testpmd: fix CPU cycles per pkt stats on transmit modes
  2020-06-18 19:28 ` Honnappa Nagarahalli
@ 2020-06-19  3:54   ` Phil Yang
  0 siblings, 0 replies; 7+ messages in thread
From: Phil Yang @ 2020-06-19  3:54 UTC (permalink / raw)
  To: Honnappa Nagarahalli, dev
  Cc: ferruh.yigit, maxime.coquelin, Ruifeng Wang, nd, stable,
	david.marchand, nd, nd

> -----Original Message-----
> From: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
> Sent: Friday, June 19, 2020 3:29 AM
> To: Phil Yang <Phil.Yang@arm.com>; dev@dpdk.org
> Cc: ferruh.yigit@intel.com; maxime.coquelin@redhat.com; Ruifeng Wang
> <Ruifeng.Wang@arm.com>; nd <nd@arm.com>; stable@dpdk.org;
> david.marchand@redhat.com; Honnappa Nagarahalli
> <Honnappa.Nagarahalli@arm.com>; nd <nd@arm.com>
> Subject: RE: [PATCH] app/testpmd: fix CPU cycles per pkt stats on transmit
> modes
> 
> <snip>
> 
> > Subject: [PATCH] app/testpmd: fix CPU cycles per pkt stats on transmit
> modes
> >
> > In txonly and flowgen forwarding mode, calculating CPU per packets with
> total
> > received packets is not accurate. Use total transmitted packets for these
> cases.
> >
> > The error output under txonly mode:
> > testpmd> show fwd stats all
> >
> > ---------------------- Forward statistics for port 0  -------------------
> > RX-packets: 0              RX-dropped: 0             RX-total: 0
> > TX-packets: 3582891927     TX-dropped: 401965824     TX-total: 3984857751
> > TX-bursts : 86381636 [0% of 0 pkts + 85% of 64 pkts + 15% of 32 pkts]
> > -------------------------------------------------------------------------
> >
> > ---------------------- Forward statistics for port 1  -------------------
> > RX-packets: 1              RX-dropped: 394351696     RX-total: 394351697
> > TX-packets: 3582890632     TX-dropped: 401965568     TX-total: 3984856200
> > TX-bursts : 86381679 [0% of 0 pkts + 85% of 64 pkts + 15% of 32 pkts]
> > -------------------------------------------------------------------------
> >
> > +++++++++++++++ Accumulated forward statistics for all
> > +++++++++++++++ ports+++++++++++++
> > RX-packets: 1              RX-dropped: 394351696     RX-total: 394351697
> > TX-packets: 7165782559     TX-dropped: 803931392     TX-total: 7969713951
> >
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> +++++++
> > ++++++++
> >
> > CPU cycles/packet=54984156291.00 \
> > (total cycles=54984156291 / total RX packets=1) at 200 MHz Clock
> >
> > Signed-off-by: Phil Yang <phil.yang@arm.com>
> > Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> > Fixes: 53324971a14e ("app/testpmd: display/clear forwarding stats on
> > demand")
> > Cc: stable@dpdk.org
> > Cc: david.marchand@redhat.com
> > ---
> >  app/test-pmd/testpmd.c | 24 +++++++++++++++++-------
> >  1 file changed, 17 insertions(+), 7 deletions(-)
> >
> > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index
> > 4989d22..798b8e0 100644
> > --- a/app/test-pmd/testpmd.c
> > +++ b/app/test-pmd/testpmd.c
> > @@ -1961,13 +1961,23 @@ fwd_stats_display(void)
> >  	       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=%.2F (total cycles="
> > -		       "%"PRIu64" / total RX packets=%"PRIu64") at %"PRIu64
> > -		       " MHz Clock\n",
> > -		       (double) fwd_cycles / total_recv,
> > -		       fwd_cycles, total_recv,
> > -		       (uint64_t)(rte_get_tsc_hz() / CYC_PER_MHZ));
> > +	if (total_recv > 0 || total_xmit > 0) {
> > +		if (strcmp(cur_fwd_eng->fwd_mode_name, "txonly") == 0
> ||
> > +		    strcmp(cur_fwd_eng->fwd_mode_name, "flowgen") == 0)
> > +			printf("\n  CPU cycles/packet=%.2F (total cycles="
> > +			     "%"PRIu64" / total %s packets=%"PRIu64") at %"
> > +			     PRIu64" MHz Clock\n",
> > +			     (double) fwd_cycles / total_xmit,
> > +			     fwd_cycles, cur_fwd_eng->fwd_mode_name,
> > total_xmit,
> > +			     (uint64_t)(rte_get_tsc_hz() / CYC_PER_MHZ));
> > +		else
> > +			printf("\n  CPU cycles/packet=%.2F (total cycles="
> > +			    "%"PRIu64" / total %s packets=%"PRIu64") at %"
> > +			    PRIu64" MHz Clock\n",
> > +			    (double) fwd_cycles / total_recv,
> > +			    fwd_cycles, cur_fwd_eng->fwd_mode_name,
> > total_recv,
> > +			    (uint64_t)(rte_get_tsc_hz() / CYC_PER_MHZ));
> > +	}
> nit. Only difference between the two 'printf' calls are total_recv vs total_xmit.
> Can be consolidated into a single printf.

OK. I can use a local flag and a ternary operator to print the ingress and the egress packets respectively.

I will update it in V2.

Thanks,
Phil

> 
> >  #endif
> >  }
> >
> > --
> > 2.7.4


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [dpdk-stable] [PATCH v2] app/testpmd: fix CPU cycles per pkt stats on transmit modes
  2020-06-18 14:50 [dpdk-stable] [PATCH] app/testpmd: fix CPU cycles per pkt stats on transmit modes Phil Yang
  2020-06-18 19:28 ` Honnappa Nagarahalli
@ 2020-06-19  4:08 ` " Phil Yang
  2020-06-22  3:39   ` Honnappa Nagarahalli
  2020-06-22  9:04   ` [dpdk-stable] [PATCH v3] " Phil Yang
  1 sibling, 2 replies; 7+ messages in thread
From: Phil Yang @ 2020-06-19  4:08 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, maxime.coquelin, Honnappa.Nagarahalli,
	ruifeng.wang, nd, stable, david.marchand

In txonly and flowgen forwarding mode, calculating CPU per packets with
total received packets is not accurate. Use total transmitted packets
for these cases.

The error output under txonly mode:
testpmd> show fwd stats all

---------------------- Forward statistics for port 0  -------------------
RX-packets: 0              RX-dropped: 0             RX-total: 0
TX-packets: 3582891927     TX-dropped: 401965824     TX-total: 3984857751
TX-bursts : 86381636 [0% of 0 pkts + 85% of 64 pkts + 15% of 32 pkts]
-------------------------------------------------------------------------

---------------------- Forward statistics for port 1  -------------------
RX-packets: 1              RX-dropped: 394351696     RX-total: 394351697
TX-packets: 3582890632     TX-dropped: 401965568     TX-total: 3984856200
TX-bursts : 86381679 [0% of 0 pkts + 85% of 64 pkts + 15% of 32 pkts]
-------------------------------------------------------------------------

+++++++++++++++ Accumulated forward statistics for all ports+++++++++++++
RX-packets: 1              RX-dropped: 394351696     RX-total: 394351697
TX-packets: 7165782559     TX-dropped: 803931392     TX-total: 7969713951
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

CPU cycles/packet=54984156291.00 \
(total cycles=54984156291 / total RX packets=1) at 200 MHz Clock

Signed-off-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Fixes: 53324971a14e ("app/testpmd: display/clear forwarding stats on demand")
Cc: stable@dpdk.org
Cc: david.marchand@redhat.com
---
v2:
Consolidate the output into a single printf. (Honnappa Nagarahalli)

 app/test-pmd/testpmd.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 4989d22..826d7dd 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1961,13 +1961,22 @@ fwd_stats_display(void)
 	       acc_stats_border, acc_stats_border);
 #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
 #define CYC_PER_MHZ 1E6
-	if (total_recv > 0)
+	if (total_recv > 0 || total_xmit > 0) {
+		uint8_t ingress;
+		if (strcmp(cur_fwd_eng->fwd_mode_name, "txonly") == 0 ||
+		    strcmp(cur_fwd_eng->fwd_mode_name, "flowgen") == 0)
+			ingress = 0;
+		else
+			ingress = 1;
+
 		printf("\n  CPU cycles/packet=%.2F (total cycles="
-		       "%"PRIu64" / total RX packets=%"PRIu64") at %"PRIu64
-		       " MHz Clock\n",
-		       (double) fwd_cycles / total_recv,
-		       fwd_cycles, total_recv,
-		       (uint64_t)(rte_get_tsc_hz() / CYC_PER_MHZ));
+			"%"PRIu64" / total %s packets=%"PRIu64") at %"
+			PRIu64" MHz Clock\n", ((double) fwd_cycles /
+				(ingress ? total_recv : total_xmit)),
+			fwd_cycles, cur_fwd_eng->fwd_mode_name,
+			(ingress ? total_recv : total_xmit),
+			(uint64_t)(rte_get_tsc_hz() / CYC_PER_MHZ));
+	}
 #endif
 }
 
-- 
2.7.4


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-stable] [PATCH v2] app/testpmd: fix CPU cycles per pkt stats on transmit modes
  2020-06-19  4:08 ` [dpdk-stable] [PATCH v2] " Phil Yang
@ 2020-06-22  3:39   ` Honnappa Nagarahalli
  2020-06-22  8:48     ` Phil Yang
  2020-06-22  9:04   ` [dpdk-stable] [PATCH v3] " Phil Yang
  1 sibling, 1 reply; 7+ messages in thread
From: Honnappa Nagarahalli @ 2020-06-22  3:39 UTC (permalink / raw)
  To: Phil Yang, dev
  Cc: ferruh.yigit, maxime.coquelin, Ruifeng Wang, nd, stable,
	david.marchand, Honnappa Nagarahalli, nd

<snip>

> Subject: [PATCH v2] app/testpmd: fix CPU cycles per pkt stats on transmit
> modes
> 
> In txonly and flowgen forwarding mode, calculating CPU per packets with
> total received packets is not accurate. Use total transmitted packets for
> these cases.
> 
> The error output under txonly mode:
> testpmd> show fwd stats all
> 
> ---------------------- Forward statistics for port 0  -------------------
> RX-packets: 0              RX-dropped: 0             RX-total: 0
> TX-packets: 3582891927     TX-dropped: 401965824     TX-total: 3984857751
> TX-bursts : 86381636 [0% of 0 pkts + 85% of 64 pkts + 15% of 32 pkts]
> -------------------------------------------------------------------------
> 
> ---------------------- Forward statistics for port 1  -------------------
> RX-packets: 1              RX-dropped: 394351696     RX-total: 394351697
> TX-packets: 3582890632     TX-dropped: 401965568     TX-total: 3984856200
> TX-bursts : 86381679 [0% of 0 pkts + 85% of 64 pkts + 15% of 32 pkts]
> -------------------------------------------------------------------------
> 
> +++++++++++++++ Accumulated forward statistics for all
> +++++++++++++++ ports+++++++++++++
> RX-packets: 1              RX-dropped: 394351696     RX-total: 394351697
> TX-packets: 7165782559     TX-dropped: 803931392     TX-total: 7969713951
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> ++++++++++
> 
> CPU cycles/packet=54984156291.00 \
> (total cycles=54984156291 / total RX packets=1) at 200 MHz Clock
> 
> Signed-off-by: Phil Yang <phil.yang@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> Fixes: 53324971a14e ("app/testpmd: display/clear forwarding stats on
> demand")
> Cc: stable@dpdk.org
> Cc: david.marchand@redhat.com
> ---
> v2:
> Consolidate the output into a single printf. (Honnappa Nagarahalli)
> 
>  app/test-pmd/testpmd.c | 21 +++++++++++++++------
>  1 file changed, 15 insertions(+), 6 deletions(-)
> 
> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index
> 4989d22..826d7dd 100644
> --- a/app/test-pmd/testpmd.c
> +++ b/app/test-pmd/testpmd.c
> @@ -1961,13 +1961,22 @@ fwd_stats_display(void)
>  	       acc_stats_border, acc_stats_border);  #ifdef
> RTE_TEST_PMD_RECORD_CORE_CYCLES  #define CYC_PER_MHZ 1E6
> -	if (total_recv > 0)
> +	if (total_recv > 0 || total_xmit > 0) {
> +		uint8_t ingress;
> +		if (strcmp(cur_fwd_eng->fwd_mode_name, "txonly") == 0 ||
> +		    strcmp(cur_fwd_eng->fwd_mode_name, "flowgen") == 0)
> +			ingress = 0;
This can be 'total_pkts = total_recv'

> +		else
> +			ingress = 1;
This can be 'total_pkts = total_xmit'

> +
>  		printf("\n  CPU cycles/packet=%.2F (total cycles="
> -		       "%"PRIu64" / total RX packets=%"PRIu64") at %"PRIu64
> -		       " MHz Clock\n",
> -		       (double) fwd_cycles / total_recv,
> -		       fwd_cycles, total_recv,
> -		       (uint64_t)(rte_get_tsc_hz() / CYC_PER_MHZ));
> +			"%"PRIu64" / total %s packets=%"PRIu64") at %"
> +			PRIu64" MHz Clock\n", ((double) fwd_cycles /
> +				(ingress ? total_recv : total_xmit)),
Can be just 'total_pkts'.

> +			fwd_cycles, cur_fwd_eng->fwd_mode_name,
> +			(ingress ? total_recv : total_xmit),
Can be just 'total_pkts'.

> +			(uint64_t)(rte_get_tsc_hz() / CYC_PER_MHZ));
> +	}
>  #endif
>  }
Otherwise,
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>

> 
> --
> 2.7.4


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-stable] [PATCH v2] app/testpmd: fix CPU cycles per pkt stats on transmit modes
  2020-06-22  3:39   ` Honnappa Nagarahalli
@ 2020-06-22  8:48     ` Phil Yang
  0 siblings, 0 replies; 7+ messages in thread
From: Phil Yang @ 2020-06-22  8:48 UTC (permalink / raw)
  To: Honnappa Nagarahalli, dev
  Cc: ferruh.yigit, maxime.coquelin, Ruifeng Wang, nd, stable,
	david.marchand, nd

> -----Original Message-----
> From: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
> Sent: Monday, June 22, 2020 11:40 AM
> To: Phil Yang <Phil.Yang@arm.com>; dev@dpdk.org
> Cc: ferruh.yigit@intel.com; maxime.coquelin@redhat.com; Ruifeng Wang
> <Ruifeng.Wang@arm.com>; nd <nd@arm.com>; stable@dpdk.org;
> david.marchand@redhat.com; Honnappa Nagarahalli
> <Honnappa.Nagarahalli@arm.com>; nd <nd@arm.com>
> Subject: RE: [PATCH v2] app/testpmd: fix CPU cycles per pkt stats on transmit
> modes
> 
> <snip>
> 
> > Subject: [PATCH v2] app/testpmd: fix CPU cycles per pkt stats on transmit
> > modes
> >
> > In txonly and flowgen forwarding mode, calculating CPU per packets with
> > total received packets is not accurate. Use total transmitted packets for
> > these cases.
> >
> > The error output under txonly mode:
> > testpmd> show fwd stats all
> >
> > ---------------------- Forward statistics for port 0  -------------------
> > RX-packets: 0              RX-dropped: 0             RX-total: 0
> > TX-packets: 3582891927     TX-dropped: 401965824     TX-total: 3984857751
> > TX-bursts : 86381636 [0% of 0 pkts + 85% of 64 pkts + 15% of 32 pkts]
> > -------------------------------------------------------------------------
> >
> > ---------------------- Forward statistics for port 1  -------------------
> > RX-packets: 1              RX-dropped: 394351696     RX-total: 394351697
> > TX-packets: 3582890632     TX-dropped: 401965568     TX-total: 3984856200
> > TX-bursts : 86381679 [0% of 0 pkts + 85% of 64 pkts + 15% of 32 pkts]
> > -------------------------------------------------------------------------
> >
> > +++++++++++++++ Accumulated forward statistics for all
> > +++++++++++++++ ports+++++++++++++
> > RX-packets: 1              RX-dropped: 394351696     RX-total: 394351697
> > TX-packets: 7165782559     TX-dropped: 803931392     TX-total: 7969713951
> >
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> +++++
> > ++++++++++
> >
> > CPU cycles/packet=54984156291.00 \
> > (total cycles=54984156291 / total RX packets=1) at 200 MHz Clock
> >
> > Signed-off-by: Phil Yang <phil.yang@arm.com>
> > Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> > Fixes: 53324971a14e ("app/testpmd: display/clear forwarding stats on
> > demand")
> > Cc: stable@dpdk.org
> > Cc: david.marchand@redhat.com
> > ---
> > v2:
> > Consolidate the output into a single printf. (Honnappa Nagarahalli)
> >
> >  app/test-pmd/testpmd.c | 21 +++++++++++++++------
> >  1 file changed, 15 insertions(+), 6 deletions(-)
> >
> > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index
> > 4989d22..826d7dd 100644
> > --- a/app/test-pmd/testpmd.c
> > +++ b/app/test-pmd/testpmd.c
> > @@ -1961,13 +1961,22 @@ fwd_stats_display(void)
> >  	       acc_stats_border, acc_stats_border);  #ifdef
> > RTE_TEST_PMD_RECORD_CORE_CYCLES  #define CYC_PER_MHZ 1E6
> > -	if (total_recv > 0)
> > +	if (total_recv > 0 || total_xmit > 0) {
> > +		uint8_t ingress;
> > +		if (strcmp(cur_fwd_eng->fwd_mode_name, "txonly") == 0
> ||
> > +		    strcmp(cur_fwd_eng->fwd_mode_name, "flowgen") == 0)
> > +			ingress = 0;
> This can be 'total_pkts = total_recv'
> 
> > +		else
> > +			ingress = 1;
> This can be 'total_pkts = total_xmit'

Agree. Much better.
Updated in V3.

Thanks,
Phil
> 
> > +
> >  		printf("\n  CPU cycles/packet=%.2F (total cycles="
> > -		       "%"PRIu64" / total RX packets=%"PRIu64") at %"PRIu64
> > -		       " MHz Clock\n",
> > -		       (double) fwd_cycles / total_recv,
> > -		       fwd_cycles, total_recv,
> > -		       (uint64_t)(rte_get_tsc_hz() / CYC_PER_MHZ));
> > +			"%"PRIu64" / total %s packets=%"PRIu64") at %"
> > +			PRIu64" MHz Clock\n", ((double) fwd_cycles /
> > +				(ingress ? total_recv : total_xmit)),
> Can be just 'total_pkts'.
> 
> > +			fwd_cycles, cur_fwd_eng->fwd_mode_name,
> > +			(ingress ? total_recv : total_xmit),
> Can be just 'total_pkts'.
> 
> > +			(uint64_t)(rte_get_tsc_hz() / CYC_PER_MHZ));
> > +	}
> >  #endif
> >  }
> Otherwise,
> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
> 
> >
> > --
> > 2.7.4


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [dpdk-stable] [PATCH v3] app/testpmd: fix CPU cycles per pkt stats on transmit modes
  2020-06-19  4:08 ` [dpdk-stable] [PATCH v2] " Phil Yang
  2020-06-22  3:39   ` Honnappa Nagarahalli
@ 2020-06-22  9:04   ` " Phil Yang
  1 sibling, 0 replies; 7+ messages in thread
From: Phil Yang @ 2020-06-22  9:04 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, maxime.coquelin, ruifeng.wang, nd, david.marchand,
	Honnappa.Nagarahalli, stable

In txonly and flowgen forwarding mode, calculating CPU per packets with
total received packets is not accurate. Use total transmitted packets
for these cases.

The error output under txonly mode:
testpmd> show fwd stats all

---------------------- Forward statistics for port 0  -------------------
RX-packets: 0              RX-dropped: 0             RX-total: 0
TX-packets: 3582891927     TX-dropped: 401965824     TX-total: 3984857751
TX-bursts : 86381636 [0% of 0 pkts + 85% of 64 pkts + 15% of 32 pkts]
-------------------------------------------------------------------------

---------------------- Forward statistics for port 1  -------------------
RX-packets: 1              RX-dropped: 394351696     RX-total: 394351697
TX-packets: 3582890632     TX-dropped: 401965568     TX-total: 3984856200
TX-bursts : 86381679 [0% of 0 pkts + 85% of 64 pkts + 15% of 32 pkts]
-------------------------------------------------------------------------

+++++++++++++++ Accumulated forward statistics for all ports+++++++++++++
RX-packets: 1              RX-dropped: 394351696     RX-total: 394351697
TX-packets: 7165782559     TX-dropped: 803931392     TX-total: 7969713951
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

CPU cycles/packet=54984156291.00 \
(total cycles=54984156291 / total RX packets=1) at 200 MHz Clock

Signed-off-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Fixes: 53324971a14e ("app/testpmd: display/clear forwarding stats on demand")
Cc: stable@dpdk.org
Cc: david.marchand@redhat.com
---
v3:
replace ingress flag with total_pkts. (Honnappa Nagarahalli)

v2:
Consolidate the output into a single printf. (Honnappa Nagarahalli)

 app/test-pmd/testpmd.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 4989d22..be47a7d 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1961,13 +1961,21 @@ fwd_stats_display(void)
 	       acc_stats_border, acc_stats_border);
 #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
 #define CYC_PER_MHZ 1E6
-	if (total_recv > 0)
+	if (total_recv > 0 || total_xmit > 0) {
+		uint64_t total_pkts = 0;
+		if (strcmp(cur_fwd_eng->fwd_mode_name, "txonly") == 0 ||
+		    strcmp(cur_fwd_eng->fwd_mode_name, "flowgen") == 0)
+			total_pkts = total_xmit;
+		else
+			total_pkts = total_recv;
+
 		printf("\n  CPU cycles/packet=%.2F (total cycles="
-		       "%"PRIu64" / total RX packets=%"PRIu64") at %"PRIu64
+		       "%"PRIu64" / total %s packets=%"PRIu64") at %"PRIu64
 		       " MHz Clock\n",
-		       (double) fwd_cycles / total_recv,
-		       fwd_cycles, total_recv,
+		       (double) fwd_cycles / total_pkts,
+		       fwd_cycles, cur_fwd_eng->fwd_mode_name, total_pkts,
 		       (uint64_t)(rte_get_tsc_hz() / CYC_PER_MHZ));
+	}
 #endif
 }
 
-- 
2.7.4


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, back to index

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-18 14:50 [dpdk-stable] [PATCH] app/testpmd: fix CPU cycles per pkt stats on transmit modes Phil Yang
2020-06-18 19:28 ` Honnappa Nagarahalli
2020-06-19  3:54   ` Phil Yang
2020-06-19  4:08 ` [dpdk-stable] [PATCH v2] " Phil Yang
2020-06-22  3:39   ` Honnappa Nagarahalli
2020-06-22  8:48     ` Phil Yang
2020-06-22  9:04   ` [dpdk-stable] [PATCH v3] " Phil Yang

patches for DPDK stable branches

Archives are clonable:
	git clone --mirror http://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ http://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/ public-inbox