* [PATCH] testpmd: optimize forward stream statistics
@ 2022-05-24 8:27 Junfeng Guo
2022-05-31 15:27 ` Andrew Rybchenko
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Junfeng Guo @ 2022-05-24 8:27 UTC (permalink / raw)
To: qi.z.zhang, jingjing.wu, beilei.xing; +Cc: dev, junfeng.guo, Xiao Wang
1. add throughput statistics for forward stream
2. display forward statistics for every forward stream
Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
---
app/test-pmd/testpmd.c | 41 ++++++++++++++++++++++++++++++++++++++---
app/test-pmd/testpmd.h | 6 ++++++
2 files changed, 44 insertions(+), 3 deletions(-)
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index fe2ce19f99..076a042e77 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1926,6 +1926,8 @@ fwd_stream_stats_display(streamid_t stream_id)
{
struct fwd_stream *fs;
static const char *fwd_top_stats_border = "-------";
+ uint64_t diff_pkts_rx, diff_pkts_tx, diff_cycles;
+ uint64_t pps_rx, pps_tx;
fs = fwd_streams[stream_id];
if ((fs->rx_packets == 0) && (fs->tx_packets == 0) &&
@@ -1939,6 +1941,21 @@ fwd_stream_stats_display(streamid_t stream_id)
" TX-dropped: %-14"PRIu64,
fs->rx_packets, fs->tx_packets, fs->fwd_dropped);
+ diff_pkts_rx = fs->rx_packets - fs->pre_rx;
+ diff_pkts_tx = fs->tx_packets - fs->pre_tx;
+ diff_cycles = fs->pre_cycles;
+
+ fs->pre_rx = fs->rx_packets;
+ fs->pre_tx = fs->tx_packets;
+ fs->pre_cycles = rte_rdtsc();
+ if (diff_cycles > 0)
+ diff_cycles = fs->pre_cycles - diff_cycles;
+
+ pps_rx = diff_cycles > 0 ?
+ (double)diff_pkts_rx * rte_get_tsc_hz() / diff_cycles : 0;
+ pps_tx = diff_cycles > 0 ?
+ (double)diff_pkts_tx * rte_get_tsc_hz() / diff_cycles : 0;
+
/* if checksum mode */
if (cur_fwd_eng == &csum_fwd_engine) {
printf(" RX- bad IP checksum: %-14"PRIu64
@@ -1952,6 +1969,11 @@ fwd_stream_stats_display(streamid_t stream_id)
printf("\n");
}
+ printf("\n Throughput (since last show)\n");
+ printf(" Rx-pps: %12"PRIu64"\n Tx-pps: %12"PRIu64"\n", pps_rx, pps_tx);
+ fs->rx_pps = pps_rx;
+ fs->tx_pps = pps_tx;
+
if (record_burst_stats) {
pkt_burst_stats_display("RX", &fs->rx_burst_stats);
pkt_burst_stats_display("TX", &fs->tx_burst_stats);
@@ -1979,6 +2001,8 @@ fwd_stats_display(void)
uint64_t fwd_cycles = 0;
uint64_t total_recv = 0;
uint64_t total_xmit = 0;
+ uint64_t total_rx_pps = 0;
+ uint64_t total_tx_pps = 0;
struct rte_port *port;
streamid_t sm_id;
portid_t pt_id;
@@ -1989,10 +2013,9 @@ fwd_stats_display(void)
for (sm_id = 0; sm_id < cur_fwd_config.nb_fwd_streams; sm_id++) {
struct fwd_stream *fs = fwd_streams[sm_id];
- if (cur_fwd_config.nb_fwd_streams >
+ fwd_stream_stats_display(sm_id);
+ if (cur_fwd_config.nb_fwd_streams ==
cur_fwd_config.nb_fwd_ports) {
- fwd_stream_stats_display(sm_id);
- } else {
ports_stats[fs->tx_port].tx_stream = fs;
ports_stats[fs->rx_port].rx_stream = fs;
}
@@ -2008,7 +2031,14 @@ fwd_stats_display(void)
if (record_core_cycles)
fwd_cycles += fs->core_cycles;
+
+ total_rx_pps += fs->rx_pps;
+ total_tx_pps += fs->tx_pps;
}
+
+ printf("\n Total Rx-pps: %12"PRIu64" Tx-pps: %12"PRIu64"\n",
+ total_rx_pps, total_tx_pps);
+
for (i = 0; i < cur_fwd_config.nb_fwd_ports; i++) {
pt_id = fwd_ports_ids[i];
port = &ports[pt_id];
@@ -2124,6 +2154,11 @@ fwd_stats_reset(void)
fs->rx_bad_l4_csum = 0;
fs->rx_bad_outer_l4_csum = 0;
fs->rx_bad_outer_ip_csum = 0;
+ fs->pre_rx = 0;
+ fs->pre_tx = 0;
+ fs->pre_cycles = 0;
+ fs->rx_pps = 0;
+ fs->tx_pps = 0;
memset(&fs->rx_burst_stats, 0, sizeof(fs->rx_burst_stats));
memset(&fs->tx_burst_stats, 0, sizeof(fs->tx_burst_stats));
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 31f766c965..cad57af27e 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -155,6 +155,12 @@ struct fwd_stream {
struct pkt_burst_stats rx_burst_stats;
struct pkt_burst_stats tx_burst_stats;
struct fwd_lcore *lcore; /**< Lcore being scheduled. */
+
+ uint64_t pre_rx;
+ uint64_t pre_tx;
+ uint64_t pre_cycles;
+ uint64_t rx_pps;
+ uint64_t tx_pps;
};
/**
--
2.25.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] testpmd: optimize forward stream statistics
2022-05-24 8:27 [PATCH] testpmd: optimize forward stream statistics Junfeng Guo
@ 2022-05-31 15:27 ` Andrew Rybchenko
2022-06-06 9:02 ` Guo, Junfeng
2022-06-01 8:46 ` Singh, Aman Deep
2022-06-06 9:39 ` [PATCH v2] app/testpmd: add throughput stats for forward streams Junfeng Guo
2 siblings, 1 reply; 10+ messages in thread
From: Andrew Rybchenko @ 2022-05-31 15:27 UTC (permalink / raw)
To: Junfeng Guo, qi.z.zhang, jingjing.wu, beilei.xing; +Cc: dev, Xiao Wang
On 5/24/22 11:27, Junfeng Guo wrote:
> 1. add throughput statistics for forward stream
> 2. display forward statistics for every forward stream
>
> Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
> Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
Sorry, I don't understand why summary say "optimize", but description
do not say what is optimized and how. It just mentioned some additions.
Shouldn't summary say:
app/testpmd: add throughput stats for forward streams
Any reviews from testpmd maintainers?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] testpmd: optimize forward stream statistics
2022-05-24 8:27 [PATCH] testpmd: optimize forward stream statistics Junfeng Guo
2022-05-31 15:27 ` Andrew Rybchenko
@ 2022-06-01 8:46 ` Singh, Aman Deep
2022-06-06 9:00 ` Guo, Junfeng
2022-06-06 9:39 ` [PATCH v2] app/testpmd: add throughput stats for forward streams Junfeng Guo
2 siblings, 1 reply; 10+ messages in thread
From: Singh, Aman Deep @ 2022-06-01 8:46 UTC (permalink / raw)
To: Junfeng Guo, qi.z.zhang, jingjing.wu, beilei.xing; +Cc: dev, Xiao Wang
Hi Junfeng
On 5/24/2022 1:57 PM, Junfeng Guo wrote:
> 1. add throughput statistics for forward stream
> 2. display forward statistics for every forward stream
>
> Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
> Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
> ---
> app/test-pmd/testpmd.c | 41 ++++++++++++++++++++++++++++++++++++++---
> app/test-pmd/testpmd.h | 6 ++++++
> 2 files changed, 44 insertions(+), 3 deletions(-)
>
> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
> index fe2ce19f99..076a042e77 100644
> --- a/app/test-pmd/testpmd.c
> +++ b/app/test-pmd/testpmd.c
> @@ -1926,6 +1926,8 @@ fwd_stream_stats_display(streamid_t stream_id)
> {
> struct fwd_stream *fs;
> static const char *fwd_top_stats_border = "-------";
> + uint64_t diff_pkts_rx, diff_pkts_tx, diff_cycles;
> + uint64_t pps_rx, pps_tx;
>
> fs = fwd_streams[stream_id];
> if ((fs->rx_packets == 0) && (fs->tx_packets == 0) &&
> @@ -1939,6 +1941,21 @@ fwd_stream_stats_display(streamid_t stream_id)
> " TX-dropped: %-14"PRIu64,
> fs->rx_packets, fs->tx_packets, fs->fwd_dropped);
>
> + diff_pkts_rx = fs->rx_packets - fs->pre_rx;
> + diff_pkts_tx = fs->tx_packets - fs->pre_tx;
> + diff_cycles = fs->pre_cycles;
> +
> + fs->pre_rx = fs->rx_packets;
> + fs->pre_tx = fs->tx_packets;
> + fs->pre_cycles = rte_rdtsc();
> + if (diff_cycles > 0)
> + diff_cycles = fs->pre_cycles - diff_cycles;
> +
> + pps_rx = diff_cycles > 0 ?
> + (double)diff_pkts_rx * rte_get_tsc_hz() / diff_cycles : 0;
> + pps_tx = diff_cycles > 0 ?
> + (double)diff_pkts_tx * rte_get_tsc_hz() / diff_cycles : 0;
> +
> /* if checksum mode */
> if (cur_fwd_eng == &csum_fwd_engine) {
> printf(" RX- bad IP checksum: %-14"PRIu64
> @@ -1952,6 +1969,11 @@ fwd_stream_stats_display(streamid_t stream_id)
> printf("\n");
> }
>
> + printf("\n Throughput (since last show)\n");
> + printf(" Rx-pps: %12"PRIu64"\n Tx-pps: %12"PRIu64"\n", pps_rx, pps_tx);
> + fs->rx_pps = pps_rx;
> + fs->tx_pps = pps_tx;
> +
> if (record_burst_stats) {
> pkt_burst_stats_display("RX", &fs->rx_burst_stats);
> pkt_burst_stats_display("TX", &fs->tx_burst_stats);
> @@ -1979,6 +2001,8 @@ fwd_stats_display(void)
> uint64_t fwd_cycles = 0;
> uint64_t total_recv = 0;
> uint64_t total_xmit = 0;
> + uint64_t total_rx_pps = 0;
> + uint64_t total_tx_pps = 0;
> struct rte_port *port;
> streamid_t sm_id;
> portid_t pt_id;
> @@ -1989,10 +2013,9 @@ fwd_stats_display(void)
> for (sm_id = 0; sm_id < cur_fwd_config.nb_fwd_streams; sm_id++) {
> struct fwd_stream *fs = fwd_streams[sm_id];
>
> - if (cur_fwd_config.nb_fwd_streams >
> + fwd_stream_stats_display(sm_id);
> + if (cur_fwd_config.nb_fwd_streams ==
> cur_fwd_config.nb_fwd_ports) {
> - fwd_stream_stats_display(sm_id);
> - } else {
> ports_stats[fs->tx_port].tx_stream = fs;
> ports_stats[fs->rx_port].rx_stream = fs;
> }
> @@ -2008,7 +2031,14 @@ fwd_stats_display(void)
>
> if (record_core_cycles)
> fwd_cycles += fs->core_cycles;
> +
> + total_rx_pps += fs->rx_pps;
> + total_tx_pps += fs->tx_pps;
> }
> +
> + printf("\n Total Rx-pps: %12"PRIu64" Tx-pps: %12"PRIu64"\n",
> + total_rx_pps, total_tx_pps);
> +
> for (i = 0; i < cur_fwd_config.nb_fwd_ports; i++) {
> pt_id = fwd_ports_ids[i];
> port = &ports[pt_id];
> @@ -2124,6 +2154,11 @@ fwd_stats_reset(void)
> fs->rx_bad_l4_csum = 0;
> fs->rx_bad_outer_l4_csum = 0;
> fs->rx_bad_outer_ip_csum = 0;
> + fs->pre_rx = 0;
> + fs->pre_tx = 0;
> + fs->pre_cycles = 0;
> + fs->rx_pps = 0;
> + fs->tx_pps = 0;
>
> memset(&fs->rx_burst_stats, 0, sizeof(fs->rx_burst_stats));
> memset(&fs->tx_burst_stats, 0, sizeof(fs->tx_burst_stats));
> diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
> index 31f766c965..cad57af27e 100644
> --- a/app/test-pmd/testpmd.h
> +++ b/app/test-pmd/testpmd.h
> @@ -155,6 +155,12 @@ struct fwd_stream {
> struct pkt_burst_stats rx_burst_stats;
> struct pkt_burst_stats tx_burst_stats;
> struct fwd_lcore *lcore; /**< Lcore being scheduled. */
> +
> + uint64_t pre_rx;
> + uint64_t pre_tx;
> + uint64_t pre_cycles;
> + uint64_t rx_pps;
> + uint64_t tx_pps;
> };
For each parameter, please add comment to describe its purpose.
Just as it is done for other parameters in the struct.
>
> /**
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [PATCH] testpmd: optimize forward stream statistics
2022-06-01 8:46 ` Singh, Aman Deep
@ 2022-06-06 9:00 ` Guo, Junfeng
0 siblings, 0 replies; 10+ messages in thread
From: Guo, Junfeng @ 2022-06-06 9:00 UTC (permalink / raw)
To: Singh, Aman Deep, Zhang, Qi Z, Wu, Jingjing, Xing, Beilei
Cc: dev, Wang, Xiao W
> -----Original Message-----
> From: Singh, Aman Deep <aman.deep.singh@intel.com>
> Sent: Wednesday, June 1, 2022 16:46
> To: Guo, Junfeng <junfeng.guo@intel.com>; Zhang, Qi Z
> <qi.z.zhang@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>; Xing,
> Beilei <beilei.xing@intel.com>
> Cc: dev@dpdk.org; Wang, Xiao W <xiao.w.wang@intel.com>
> Subject: Re: [PATCH] testpmd: optimize forward stream statistics
>
> Hi Junfeng
>
> On 5/24/2022 1:57 PM, Junfeng Guo wrote:
> > 1. add throughput statistics for forward stream
> > 2. display forward statistics for every forward stream
> >
> > Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
> > Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
> > ---
> > app/test-pmd/testpmd.c | 41
> ++++++++++++++++++++++++++++++++++++++---
> > app/test-pmd/testpmd.h | 6 ++++++
> > 2 files changed, 44 insertions(+), 3 deletions(-)
> >
> > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
> > index fe2ce19f99..076a042e77 100644
> > --- a/app/test-pmd/testpmd.c
> > +++ b/app/test-pmd/testpmd.c
> > @@ -1926,6 +1926,8 @@ fwd_stream_stats_display(streamid_t
> stream_id)
> > {
> > struct fwd_stream *fs;
> > static const char *fwd_top_stats_border = "-------";
> > + uint64_t diff_pkts_rx, diff_pkts_tx, diff_cycles;
> > + uint64_t pps_rx, pps_tx;
> >
> > fs = fwd_streams[stream_id];
> > if ((fs->rx_packets == 0) && (fs->tx_packets == 0) &&
> > @@ -1939,6 +1941,21 @@ fwd_stream_stats_display(streamid_t
> stream_id)
> > " TX-dropped: %-14"PRIu64,
> > fs->rx_packets, fs->tx_packets, fs->fwd_dropped);
> >
> > + diff_pkts_rx = fs->rx_packets - fs->pre_rx;
> > + diff_pkts_tx = fs->tx_packets - fs->pre_tx;
> > + diff_cycles = fs->pre_cycles;
> > +
> > + fs->pre_rx = fs->rx_packets;
> > + fs->pre_tx = fs->tx_packets;
> > + fs->pre_cycles = rte_rdtsc();
> > + if (diff_cycles > 0)
> > + diff_cycles = fs->pre_cycles - diff_cycles;
> > +
> > + pps_rx = diff_cycles > 0 ?
> > + (double)diff_pkts_rx * rte_get_tsc_hz() / diff_cycles : 0;
> > + pps_tx = diff_cycles > 0 ?
> > + (double)diff_pkts_tx * rte_get_tsc_hz() / diff_cycles : 0;
> > +
> > /* if checksum mode */
> > if (cur_fwd_eng == &csum_fwd_engine) {
> > printf(" RX- bad IP checksum: %-14"PRIu64
> > @@ -1952,6 +1969,11 @@ fwd_stream_stats_display(streamid_t
> stream_id)
> > printf("\n");
> > }
> >
> > + printf("\n Throughput (since last show)\n");
> > + printf(" Rx-pps: %12"PRIu64"\n Tx-pps: %12"PRIu64"\n", pps_rx,
> pps_tx);
> > + fs->rx_pps = pps_rx;
> > + fs->tx_pps = pps_tx;
> > +
> > if (record_burst_stats) {
> > pkt_burst_stats_display("RX", &fs->rx_burst_stats);
> > pkt_burst_stats_display("TX", &fs->tx_burst_stats);
> > @@ -1979,6 +2001,8 @@ fwd_stats_display(void)
> > uint64_t fwd_cycles = 0;
> > uint64_t total_recv = 0;
> > uint64_t total_xmit = 0;
> > + uint64_t total_rx_pps = 0;
> > + uint64_t total_tx_pps = 0;
> > struct rte_port *port;
> > streamid_t sm_id;
> > portid_t pt_id;
> > @@ -1989,10 +2013,9 @@ fwd_stats_display(void)
> > for (sm_id = 0; sm_id < cur_fwd_config.nb_fwd_streams;
> sm_id++) {
> > struct fwd_stream *fs = fwd_streams[sm_id];
> >
> > - if (cur_fwd_config.nb_fwd_streams >
> > + fwd_stream_stats_display(sm_id);
> > + if (cur_fwd_config.nb_fwd_streams ==
> > cur_fwd_config.nb_fwd_ports) {
> > - fwd_stream_stats_display(sm_id);
> > - } else {
> > ports_stats[fs->tx_port].tx_stream = fs;
> > ports_stats[fs->rx_port].rx_stream = fs;
> > }
> > @@ -2008,7 +2031,14 @@ fwd_stats_display(void)
> >
> > if (record_core_cycles)
> > fwd_cycles += fs->core_cycles;
> > +
> > + total_rx_pps += fs->rx_pps;
> > + total_tx_pps += fs->tx_pps;
> > }
> > +
> > + printf("\n Total Rx-pps: %12"PRIu64" Tx-pps: %12"PRIu64"\n",
> > + total_rx_pps, total_tx_pps);
> > +
> > for (i = 0; i < cur_fwd_config.nb_fwd_ports; i++) {
> > pt_id = fwd_ports_ids[i];
> > port = &ports[pt_id];
> > @@ -2124,6 +2154,11 @@ fwd_stats_reset(void)
> > fs->rx_bad_l4_csum = 0;
> > fs->rx_bad_outer_l4_csum = 0;
> > fs->rx_bad_outer_ip_csum = 0;
> > + fs->pre_rx = 0;
> > + fs->pre_tx = 0;
> > + fs->pre_cycles = 0;
> > + fs->rx_pps = 0;
> > + fs->tx_pps = 0;
> >
> > memset(&fs->rx_burst_stats, 0, sizeof(fs-
> >rx_burst_stats));
> > memset(&fs->tx_burst_stats, 0, sizeof(fs-
> >tx_burst_stats));
> > diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
> > index 31f766c965..cad57af27e 100644
> > --- a/app/test-pmd/testpmd.h
> > +++ b/app/test-pmd/testpmd.h
> > @@ -155,6 +155,12 @@ struct fwd_stream {
> > struct pkt_burst_stats rx_burst_stats;
> > struct pkt_burst_stats tx_burst_stats;
> > struct fwd_lcore *lcore; /**< Lcore being scheduled. */
> > +
> > + uint64_t pre_rx;
> > + uint64_t pre_tx;
> > + uint64_t pre_cycles;
> > + uint64_t rx_pps;
> > + uint64_t tx_pps;
> > };
> For each parameter, please add comment to describe its purpose.
> Just as it is done for other parameters in the struct.
Thanks for your review and comments!
I'll update the code in the coming version.
Regards,
Junfeng Guo
> >
> > /**
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [PATCH] testpmd: optimize forward stream statistics
2022-05-31 15:27 ` Andrew Rybchenko
@ 2022-06-06 9:02 ` Guo, Junfeng
0 siblings, 0 replies; 10+ messages in thread
From: Guo, Junfeng @ 2022-06-06 9:02 UTC (permalink / raw)
To: Andrew Rybchenko, Zhang, Qi Z, Wu, Jingjing, Xing, Beilei
Cc: dev, Wang, Xiao W
> -----Original Message-----
> From: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> Sent: Tuesday, May 31, 2022 23:28
> To: Guo, Junfeng <junfeng.guo@intel.com>; Zhang, Qi Z
> <qi.z.zhang@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>; Xing,
> Beilei <beilei.xing@intel.com>
> Cc: dev@dpdk.org; Wang, Xiao W <xiao.w.wang@intel.com>
> Subject: Re: [PATCH] testpmd: optimize forward stream statistics
>
> On 5/24/22 11:27, Junfeng Guo wrote:
> > 1. add throughput statistics for forward stream
> > 2. display forward statistics for every forward stream
> >
> > Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
> > Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
>
> Sorry, I don't understand why summary say "optimize", but description
> do not say what is optimized and how. It just mentioned some additions.
>
> Shouldn't summary say:
> app/testpmd: add throughput stats for forward streams
Thanks for your review and comments!
I'll update the patch in the coming version.
Regards,
Junfeng Guo
>
> Any reviews from testpmd maintainers?
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2] app/testpmd: add throughput stats for forward streams
2022-05-24 8:27 [PATCH] testpmd: optimize forward stream statistics Junfeng Guo
2022-05-31 15:27 ` Andrew Rybchenko
2022-06-01 8:46 ` Singh, Aman Deep
@ 2022-06-06 9:39 ` Junfeng Guo
2022-06-16 16:39 ` Singh, Aman Deep
2 siblings, 1 reply; 10+ messages in thread
From: Junfeng Guo @ 2022-06-06 9:39 UTC (permalink / raw)
To: qi.z.zhang, jingjing.wu, beilei.xing; +Cc: dev, junfeng.guo, Xiao Wang
1. add throughput statistics (in pps) for forward streams.
2. display the forward statistics for every forward stream.
v2:
add parameter descriptions and fix commit title.
Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
---
app/test-pmd/testpmd.c | 41 ++++++++++++++++++++++++++++++++++++++---
app/test-pmd/testpmd.h | 6 ++++++
2 files changed, 44 insertions(+), 3 deletions(-)
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index fe2ce19f99..076a042e77 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1926,6 +1926,8 @@ fwd_stream_stats_display(streamid_t stream_id)
{
struct fwd_stream *fs;
static const char *fwd_top_stats_border = "-------";
+ uint64_t diff_pkts_rx, diff_pkts_tx, diff_cycles;
+ uint64_t pps_rx, pps_tx;
fs = fwd_streams[stream_id];
if ((fs->rx_packets == 0) && (fs->tx_packets == 0) &&
@@ -1939,6 +1941,21 @@ fwd_stream_stats_display(streamid_t stream_id)
" TX-dropped: %-14"PRIu64,
fs->rx_packets, fs->tx_packets, fs->fwd_dropped);
+ diff_pkts_rx = fs->rx_packets - fs->pre_rx;
+ diff_pkts_tx = fs->tx_packets - fs->pre_tx;
+ diff_cycles = fs->pre_cycles;
+
+ fs->pre_rx = fs->rx_packets;
+ fs->pre_tx = fs->tx_packets;
+ fs->pre_cycles = rte_rdtsc();
+ if (diff_cycles > 0)
+ diff_cycles = fs->pre_cycles - diff_cycles;
+
+ pps_rx = diff_cycles > 0 ?
+ (double)diff_pkts_rx * rte_get_tsc_hz() / diff_cycles : 0;
+ pps_tx = diff_cycles > 0 ?
+ (double)diff_pkts_tx * rte_get_tsc_hz() / diff_cycles : 0;
+
/* if checksum mode */
if (cur_fwd_eng == &csum_fwd_engine) {
printf(" RX- bad IP checksum: %-14"PRIu64
@@ -1952,6 +1969,11 @@ fwd_stream_stats_display(streamid_t stream_id)
printf("\n");
}
+ printf("\n Throughput (since last show)\n");
+ printf(" Rx-pps: %12"PRIu64"\n Tx-pps: %12"PRIu64"\n", pps_rx, pps_tx);
+ fs->rx_pps = pps_rx;
+ fs->tx_pps = pps_tx;
+
if (record_burst_stats) {
pkt_burst_stats_display("RX", &fs->rx_burst_stats);
pkt_burst_stats_display("TX", &fs->tx_burst_stats);
@@ -1979,6 +2001,8 @@ fwd_stats_display(void)
uint64_t fwd_cycles = 0;
uint64_t total_recv = 0;
uint64_t total_xmit = 0;
+ uint64_t total_rx_pps = 0;
+ uint64_t total_tx_pps = 0;
struct rte_port *port;
streamid_t sm_id;
portid_t pt_id;
@@ -1989,10 +2013,9 @@ fwd_stats_display(void)
for (sm_id = 0; sm_id < cur_fwd_config.nb_fwd_streams; sm_id++) {
struct fwd_stream *fs = fwd_streams[sm_id];
- if (cur_fwd_config.nb_fwd_streams >
+ fwd_stream_stats_display(sm_id);
+ if (cur_fwd_config.nb_fwd_streams ==
cur_fwd_config.nb_fwd_ports) {
- fwd_stream_stats_display(sm_id);
- } else {
ports_stats[fs->tx_port].tx_stream = fs;
ports_stats[fs->rx_port].rx_stream = fs;
}
@@ -2008,7 +2031,14 @@ fwd_stats_display(void)
if (record_core_cycles)
fwd_cycles += fs->core_cycles;
+
+ total_rx_pps += fs->rx_pps;
+ total_tx_pps += fs->tx_pps;
}
+
+ printf("\n Total Rx-pps: %12"PRIu64" Tx-pps: %12"PRIu64"\n",
+ total_rx_pps, total_tx_pps);
+
for (i = 0; i < cur_fwd_config.nb_fwd_ports; i++) {
pt_id = fwd_ports_ids[i];
port = &ports[pt_id];
@@ -2124,6 +2154,11 @@ fwd_stats_reset(void)
fs->rx_bad_l4_csum = 0;
fs->rx_bad_outer_l4_csum = 0;
fs->rx_bad_outer_ip_csum = 0;
+ fs->pre_rx = 0;
+ fs->pre_tx = 0;
+ fs->pre_cycles = 0;
+ fs->rx_pps = 0;
+ fs->tx_pps = 0;
memset(&fs->rx_burst_stats, 0, sizeof(fs->rx_burst_stats));
memset(&fs->tx_burst_stats, 0, sizeof(fs->tx_burst_stats));
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 31f766c965..dc1bba5637 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -155,6 +155,12 @@ struct fwd_stream {
struct pkt_burst_stats rx_burst_stats;
struct pkt_burst_stats tx_burst_stats;
struct fwd_lcore *lcore; /**< Lcore being scheduled. */
+
+ uint64_t pre_rx; /**< previously recorded received packets */
+ uint64_t pre_tx; /**< previously recorded transmitted packets */
+ uint64_t pre_cycles; /**< previously recorded processor's time-stamp counter cycles */
+ uint64_t rx_pps; /**< throughput of received packets in pps */
+ uint64_t tx_pps; /**< throughput of transmitted packets in pps */
};
/**
--
2.25.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2] app/testpmd: add throughput stats for forward streams
2022-06-06 9:39 ` [PATCH v2] app/testpmd: add throughput stats for forward streams Junfeng Guo
@ 2022-06-16 16:39 ` Singh, Aman Deep
2022-08-11 6:57 ` Guo, Junfeng
0 siblings, 1 reply; 10+ messages in thread
From: Singh, Aman Deep @ 2022-06-16 16:39 UTC (permalink / raw)
To: Junfeng Guo, qi.z.zhang, jingjing.wu, beilei.xing; +Cc: dev, Xiao Wang
Hi Junfeng,
Thanks for the patch.
On 6/6/2022 3:09 PM, Junfeng Guo wrote:
> 1. add throughput statistics (in pps) for forward streams.
> 2. display the forward statistics for every forward stream.
>
> v2:
> add parameter descriptions and fix commit title.
>
> Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
> Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
> ---
>
We do have per port Rx/Tx pps in display stats.
For per forward stream we can enable "--record-burst-stats".
With it we can get per fwd stream Rx/Tx pps.
Please check if this patch is adding any additional functionality.
<snip>
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [PATCH v2] app/testpmd: add throughput stats for forward streams
2022-06-16 16:39 ` Singh, Aman Deep
@ 2022-08-11 6:57 ` Guo, Junfeng
2022-08-16 9:32 ` Ferruh Yigit
0 siblings, 1 reply; 10+ messages in thread
From: Guo, Junfeng @ 2022-08-11 6:57 UTC (permalink / raw)
To: Singh, Aman Deep, Zhang, Qi Z, Wu, Jingjing, Xing, Beilei
Cc: dev, Wang, Xiao W
> -----Original Message-----
> From: Singh, Aman Deep <aman.deep.singh@intel.com>
> Sent: Friday, June 17, 2022 00:40
> To: Guo, Junfeng <junfeng.guo@intel.com>; Zhang, Qi Z
> <qi.z.zhang@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>; Xing,
> Beilei <beilei.xing@intel.com>
> Cc: dev@dpdk.org; Wang, Xiao W <xiao.w.wang@intel.com>
> Subject: Re: [PATCH v2] app/testpmd: add throughput stats for
> forward streams
>
> Hi Junfeng,
>
> Thanks for the patch.
>
>
> On 6/6/2022 3:09 PM, Junfeng Guo wrote:
> > 1. add throughput statistics (in pps) for forward streams.
> > 2. display the forward statistics for every forward stream.
> >
> > v2:
> > add parameter descriptions and fix commit title.
> >
> > Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
> > Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
> > ---
> >
> We do have per port Rx/Tx pps in display stats.
> For per forward stream we can enable "--record-burst-stats".
> With it we can get per fwd stream Rx/Tx pps.
>
> Please check if this patch is adding any additional functionality.
Sorry for the late reply.
Seems that "--record-burst-stats" could only show the stats of Rx/Tx bursts.
Actually this patch can enable the throughput stats, which has not been supported in current testpmd.
So we hope this functionality could be added.
Thanks!
>
> <snip>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2] app/testpmd: add throughput stats for forward streams
2022-08-11 6:57 ` Guo, Junfeng
@ 2022-08-16 9:32 ` Ferruh Yigit
2022-08-18 6:57 ` Guo, Junfeng
0 siblings, 1 reply; 10+ messages in thread
From: Ferruh Yigit @ 2022-08-16 9:32 UTC (permalink / raw)
To: Guo, Junfeng, Singh, Aman Deep, Zhang, Qi Z, Wu, Jingjing, Xing, Beilei
Cc: dev, Wang, Xiao W, Honnappa Nagarahalli
On 8/11/2022 7:57 AM, Guo, Junfeng wrote:
>
>
>> -----Original Message-----
>> From: Singh, Aman Deep <aman.deep.singh@intel.com>
>> Sent: Friday, June 17, 2022 00:40
>> To: Guo, Junfeng <junfeng.guo@intel.com>; Zhang, Qi Z
>> <qi.z.zhang@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>; Xing,
>> Beilei <beilei.xing@intel.com>
>> Cc: dev@dpdk.org; Wang, Xiao W <xiao.w.wang@intel.com>
>> Subject: Re: [PATCH v2] app/testpmd: add throughput stats for
>> forward streams
>>
>> Hi Junfeng,
>>
>> Thanks for the patch.
>>
>>
>> On 6/6/2022 3:09 PM, Junfeng Guo wrote:
>>> 1. add throughput statistics (in pps) for forward streams.
>>> 2. display the forward statistics for every forward stream.
>>>
>>> v2:
>>> add parameter descriptions and fix commit title.
>>>
>>> Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
>>> Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
>>> ---
>>>
>> We do have per port Rx/Tx pps in display stats.
>> For per forward stream we can enable "--record-burst-stats".
>> With it we can get per fwd stream Rx/Tx pps.
>>
>> Please check if this patch is adding any additional functionality.
>
> Sorry for the late reply.
> Seems that "--record-burst-stats" could only show the stats of Rx/Tx bursts.
>
Hi Junfeng,
What is the impact of this change to the performance?
And what do you think enabling it with an command,
like existing "set record-*" ones?
> Actually this patch can enable the throughput stats, which has not been supported in current testpmd.
> So we hope this functionality could be added.
> Thanks!
>
>>
>> <snip>
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [PATCH v2] app/testpmd: add throughput stats for forward streams
2022-08-16 9:32 ` Ferruh Yigit
@ 2022-08-18 6:57 ` Guo, Junfeng
0 siblings, 0 replies; 10+ messages in thread
From: Guo, Junfeng @ 2022-08-18 6:57 UTC (permalink / raw)
To: Ferruh Yigit, Singh, Aman Deep, Zhang, Qi Z, Wu, Jingjing, Xing, Beilei
Cc: dev, Wang, Xiao W, Honnappa Nagarahalli
> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit@xilinx.com>
> Sent: Tuesday, August 16, 2022 17:33
> To: Guo, Junfeng <junfeng.guo@intel.com>; Singh, Aman Deep
> <aman.deep.singh@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>; Wu,
> Jingjing <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>
> Cc: dev@dpdk.org; Wang, Xiao W <xiao.w.wang@intel.com>; Honnappa
> Nagarahalli <Honnappa.Nagarahalli@arm.com>
> Subject: Re: [PATCH v2] app/testpmd: add throughput stats for forward
> streams
>
> On 8/11/2022 7:57 AM, Guo, Junfeng wrote:
> >
> >
> >> -----Original Message-----
> >> From: Singh, Aman Deep <aman.deep.singh@intel.com>
> >> Sent: Friday, June 17, 2022 00:40
> >> To: Guo, Junfeng <junfeng.guo@intel.com>; Zhang, Qi Z
> >> <qi.z.zhang@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>; Xing,
> >> Beilei <beilei.xing@intel.com>
> >> Cc: dev@dpdk.org; Wang, Xiao W <xiao.w.wang@intel.com>
> >> Subject: Re: [PATCH v2] app/testpmd: add throughput stats for
> >> forward streams
> >>
> >> Hi Junfeng,
> >>
> >> Thanks for the patch.
> >>
> >>
> >> On 6/6/2022 3:09 PM, Junfeng Guo wrote:
> >>> 1. add throughput statistics (in pps) for forward streams.
> >>> 2. display the forward statistics for every forward stream.
> >>>
> >>> v2:
> >>> add parameter descriptions and fix commit title.
> >>>
> >>> Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
> >>> Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
> >>> ---
> >>>
> >> We do have per port Rx/Tx pps in display stats.
> >> For per forward stream we can enable "--record-burst-stats".
> >> With it we can get per fwd stream Rx/Tx pps.
> >>
> >> Please check if this patch is adding any additional functionality.
> >
> > Sorry for the late reply.
> > Seems that "--record-burst-stats" could only show the stats of Rx/Tx
> bursts.
> >
>
> Hi Junfeng,
>
> What is the impact of this change to the performance?
>
> And what do you think enabling it with an command,
> like existing "set record-*" ones?
Thanks for your advice!
We will consider about this method, and also the performance impact.
Thanks a lot!
Regards,
Junfeng Guo
>
> > Actually this patch can enable the throughput stats, which has not been
> supported in current testpmd.
> > So we hope this functionality could be added.
> > Thanks!
> >
> >>
> >> <snip>
> >
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2022-08-18 6:57 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-24 8:27 [PATCH] testpmd: optimize forward stream statistics Junfeng Guo
2022-05-31 15:27 ` Andrew Rybchenko
2022-06-06 9:02 ` Guo, Junfeng
2022-06-01 8:46 ` Singh, Aman Deep
2022-06-06 9:00 ` Guo, Junfeng
2022-06-06 9:39 ` [PATCH v2] app/testpmd: add throughput stats for forward streams Junfeng Guo
2022-06-16 16:39 ` Singh, Aman Deep
2022-08-11 6:57 ` Guo, Junfeng
2022-08-16 9:32 ` Ferruh Yigit
2022-08-18 6:57 ` Guo, Junfeng
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).