From: Matan Azrad <matan@mellanox.com>
To: Wenzhuo Lu <wenzhuo.lu@intel.com>, Jingjing Wu <jingjing.wu@intel.com>
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 2/2] app/testpmd: add bits per second to statistics
Date: Mon, 29 Jul 2019 12:36:57 +0000 [thread overview]
Message-ID: <1564403817-13438-2-git-send-email-matan@mellanox.com> (raw)
In-Reply-To: <1564403817-13438-1-git-send-email-matan@mellanox.com>
Traffic bps statistics is very useful for performance testing.
Add bits per second statistics for Rx and Tx.
Signed-off-by: Matan Azrad <matan@mellanox.com>
---
app/test-pmd/config.c | 24 ++++++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 1a5a5c1..88bc716 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -119,9 +119,12 @@
{
static uint64_t prev_pkts_rx[RTE_MAX_ETHPORTS];
static uint64_t prev_pkts_tx[RTE_MAX_ETHPORTS];
+ static uint64_t prev_bytes_rx[RTE_MAX_ETHPORTS];
+ static uint64_t prev_bytes_tx[RTE_MAX_ETHPORTS];
static uint64_t prev_cycles[RTE_MAX_ETHPORTS];
- uint64_t diff_pkts_rx, diff_pkts_tx, diff_cycles;
- uint64_t mpps_rx, mpps_tx;
+ uint64_t diff_pkts_rx, diff_pkts_tx, diff_bytes_rx, diff_bytes_tx,
+ diff_cycles;
+ uint64_t mpps_rx, mpps_tx, mbps_rx, mbps_tx;
struct rte_eth_stats stats;
struct rte_port *port = &ports[port_id];
uint8_t i;
@@ -192,9 +195,22 @@
diff_pkts_rx * rte_get_tsc_hz() / diff_cycles : 0;
mpps_tx = diff_cycles > 0 ?
diff_pkts_tx * rte_get_tsc_hz() / diff_cycles : 0;
+
+ diff_bytes_rx = (stats.ibytes > prev_bytes_rx[port_id]) ?
+ (stats.ibytes - prev_bytes_rx[port_id]) : 0;
+ diff_bytes_tx = (stats.obytes > prev_bytes_tx[port_id]) ?
+ (stats.obytes - prev_bytes_tx[port_id]) : 0;
+ prev_bytes_rx[port_id] = stats.ibytes;
+ prev_bytes_tx[port_id] = stats.obytes;
+ mbps_rx = diff_cycles > 0 ?
+ diff_bytes_rx * rte_get_tsc_hz() / diff_cycles : 0;
+ mbps_tx = diff_cycles > 0 ?
+ diff_bytes_tx * rte_get_tsc_hz() / diff_cycles : 0;
+
printf("\n Throughput (since last show)\n");
- printf(" Rx-pps: %12"PRIu64"\n Tx-pps: %12"PRIu64"\n",
- mpps_rx, mpps_tx);
+ printf(" Rx-pps: %12"PRIu64" Rx-bps: %12"PRIu64"\n Tx-pps: %12"
+ PRIu64" Tx-bps: %12"PRIu64"\n", mpps_rx, mbps_rx * 8,
+ mpps_tx, mbps_tx * 8);
printf(" %s############################%s\n",
nic_stats_border, nic_stats_border);
--
1.8.3.1
next prev parent reply other threads:[~2019-07-29 12:37 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-29 12:36 [dpdk-dev] [PATCH 1/2] app/testpmd: fix scatter offload configuration Matan Azrad
2019-07-29 12:36 ` Matan Azrad [this message]
2019-07-30 11:41 ` [dpdk-dev] [PATCH 2/2] app/testpmd: add bits per second to statistics Moti Haimovsky
2019-10-08 14:19 ` Yigit, Ferruh
2019-07-30 9:00 ` [dpdk-dev] [PATCH 1/2] app/testpmd: fix scatter offload configuration Matan Azrad
2019-07-30 11:36 ` Moti Haimovsky
2019-07-30 13:09 ` Ferruh Yigit
2019-07-30 13:17 ` Matan Azrad
2019-07-30 15:21 ` Ferruh Yigit
2019-07-30 15:56 ` Matan Azrad
2019-07-30 17:28 ` Ferruh Yigit
2019-07-30 18:34 ` Matan Azrad
2019-07-30 18:55 ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
2019-07-31 6:11 ` Matan Azrad
2019-10-08 14:18 ` Yigit, Ferruh
2019-10-22 7:06 ` Matan Azrad
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1564403817-13438-2-git-send-email-matan@mellanox.com \
--to=matan@mellanox.com \
--cc=dev@dpdk.org \
--cc=jingjing.wu@intel.com \
--cc=wenzhuo.lu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).