From: Remy Horton <remy.horton@intel.com>
To: dev@dpdk.org
Cc: Thomas Monjalon <thomas.monjalon@6wind.com>
Subject: [dpdk-dev] [PATCH v13 4/6] app/test-pmd: add bitrate statistics calculation
Date: Wed, 29 Mar 2017 19:28:46 +0100 [thread overview]
Message-ID: <1490812128-4172-5-git-send-email-remy.horton@intel.com> (raw)
In-Reply-To: <1490812128-4172-1-git-send-email-remy.horton@intel.com>
Calculate bitrate statistics using the bitrate stats library. The
resulting statistics can be viewed via proc_info.
Signed-off-by: Remy Horton <remy.horton@intel.com>
---
app/test-pmd/testpmd.c | 41 +++++++++++++++++++++++++++++++++++++++--
1 file changed, 39 insertions(+), 2 deletions(-)
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index e04e215..fc96f36 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
- * Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
+ * Copyright(c) 2010-2017 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -79,6 +79,10 @@
#include <rte_pdump.h>
#endif
#include <rte_flow.h>
+#include <rte_metrics.h>
+#ifdef RTE_LIBRTE_BITRATE
+#include <rte_bitrate.h>
+#endif
#include "testpmd.h"
@@ -323,6 +327,9 @@ uint16_t nb_rx_queue_stats_mappings = 0;
unsigned max_socket = 0;
+/* Bitrate statistics */
+struct rte_stats_bitrates *bitrate_data;
+
/* Forward function declarations */
static void map_port_queue_stats_mapping_registers(uint8_t pi, struct rte_port *port);
static void check_all_ports_link_status(uint32_t port_mask);
@@ -922,12 +929,30 @@ run_pkt_fwd_on_lcore(struct fwd_lcore *fc, packet_fwd_t pkt_fwd)
struct fwd_stream **fsm;
streamid_t nb_fs;
streamid_t sm_id;
-
+#ifdef RTE_LIBRTE_BITRATE
+ uint64_t tics_per_1sec;
+ uint64_t tics_datum;
+ uint64_t tics_current;
+ uint8_t idx_port, cnt_ports;
+
+ cnt_ports = rte_eth_dev_count();
+ tics_datum = rte_rdtsc();
+ tics_per_1sec = rte_get_timer_hz();
+#endif
fsm = &fwd_streams[fc->stream_idx];
nb_fs = fc->stream_nb;
do {
for (sm_id = 0; sm_id < nb_fs; sm_id++)
(*pkt_fwd)(fsm[sm_id]);
+#ifdef RTE_LIBRTE_BITRATE
+ tics_current = rte_rdtsc();
+ if (tics_current - tics_datum >= tics_per_1sec) {
+ /* Periodic bitrate calculation */
+ for (idx_port = 0; idx_port < cnt_ports; idx_port++)
+ rte_stats_bitrate_calc(bitrate_data, idx_port);
+ tics_datum = tics_current;
+ }
+#endif
} while (! fc->stopped);
}
@@ -2139,6 +2164,18 @@ main(int argc, char** argv)
FOREACH_PORT(port_id, ports)
rte_eth_promiscuous_enable(port_id);
+ /* Init metrics library */
+ rte_metrics_init(rte_socket_id());
+
+ /* Setup bitrate stats */
+#ifdef RTE_LIBRTE_BITRATE
+ bitrate_data = rte_stats_bitrate_create();
+ if (bitrate_data == NULL)
+ rte_exit(EXIT_FAILURE, "Could not allocate bitrate data.\n");
+ rte_stats_bitrate_reg(bitrate_data);
+#endif
+
+
#ifdef RTE_LIBRTE_CMDLINE
if (interactive == 1) {
if (auto_start) {
--
2.5.5
next prev parent reply other threads:[~2017-03-29 18:28 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-27 20:21 [dpdk-dev] [PATCH v12 0/6] Expanded statistics reporting Remy Horton
2017-03-27 20:21 ` [dpdk-dev] [PATCH v12 1/6] lib: add information metrics library Remy Horton
2017-03-28 14:14 ` Pattan, Reshma
2017-03-28 15:00 ` Remy Horton
2017-03-27 20:21 ` [dpdk-dev] [PATCH v12 2/6] app/proc_info: add metrics displaying Remy Horton
2017-03-27 20:21 ` [dpdk-dev] [PATCH v12 3/6] lib: add bitrate statistics library Remy Horton
2017-03-28 15:30 ` Pattan, Reshma
2017-03-28 15:45 ` Remy Horton
2017-03-27 20:21 ` [dpdk-dev] [PATCH v12 4/6] app/test-pmd: add bitrate statistics calculation Remy Horton
2017-03-28 15:49 ` Pattan, Reshma
2017-03-27 20:21 ` [dpdk-dev] [PATCH v12 5/6] lib: added new library for latency stats Remy Horton
2017-03-27 20:21 ` [dpdk-dev] [PATCH v12 6/6] app/test-pmd: add latency statistics calculation Remy Horton
2017-03-27 21:03 ` [dpdk-dev] [PATCH v12 0/6] Expanded statistics reporting Stephen Hemminger
2017-03-28 11:21 ` Mcnamara, John
2017-03-29 18:28 ` [dpdk-dev] [PATCH v13 " Remy Horton
2017-03-29 18:28 ` [dpdk-dev] [PATCH v13 1/6] lib: add information metrics library Remy Horton
2017-03-30 10:01 ` Pattan, Reshma
2017-03-29 18:28 ` [dpdk-dev] [PATCH v13 2/6] app/proc_info: add metrics displaying Remy Horton
2017-03-29 18:28 ` [dpdk-dev] [PATCH v13 3/6] lib: add bitrate statistics library Remy Horton
2017-03-30 10:04 ` Pattan, Reshma
2017-03-30 10:08 ` Pattan, Reshma
2017-03-29 18:28 ` Remy Horton [this message]
2017-03-29 18:28 ` [dpdk-dev] [PATCH v13 5/6] lib: added new library for latency stats Remy Horton
2017-03-29 18:28 ` [dpdk-dev] [PATCH v13 6/6] app/test-pmd: add latency statistics calculation Remy Horton
2017-03-30 10:22 ` Pattan, Reshma
2017-03-30 13:18 ` [dpdk-dev] [PATCH v13 0/6] Expanded statistics reporting Pattan, Reshma
2017-03-30 21:00 ` [dpdk-dev] [PATCH v14 " Remy Horton
2017-03-30 21:00 ` [dpdk-dev] [PATCH v14 1/6] lib: add information metrics library Remy Horton
2017-04-05 13:39 ` Thomas Monjalon
2017-04-05 14:46 ` Remy Horton
2017-04-05 15:06 ` Thomas Monjalon
2017-04-05 15:16 ` Remy Horton
2017-04-05 15:23 ` Thomas Monjalon
2017-03-30 21:00 ` [dpdk-dev] [PATCH v14 2/6] app/proc_info: add metrics displaying Remy Horton
2017-03-30 21:00 ` [dpdk-dev] [PATCH v14 3/6] lib: add bitrate statistics library Remy Horton
2017-03-30 21:01 ` [dpdk-dev] [PATCH v14 4/6] app/test-pmd: add bitrate statistics calculation Remy Horton
2017-03-30 21:01 ` [dpdk-dev] [PATCH v14 5/6] lib: added new library for latency stats Remy Horton
2017-04-05 14:24 ` Thomas Monjalon
2017-04-05 14:34 ` Remy Horton
2017-03-30 21:01 ` [dpdk-dev] [PATCH v14 6/6] app/test-pmd: add latency statistics calculation Remy Horton
2017-04-05 16:01 ` [dpdk-dev] [PATCH v14 0/6] Expanded statistics reporting Thomas Monjalon
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=1490812128-4172-5-git-send-email-remy.horton@intel.com \
--to=remy.horton@intel.com \
--cc=dev@dpdk.org \
--cc=thomas.monjalon@6wind.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).