From 30c686d5de018612cf404520d139a9b5a021ea32 Mon Sep 17 00:00:00 2001 From: imarom Date: Mon, 21 Sep 2015 13:46:33 +0300 Subject: checkpoint - added stats and some python code --- src/stateless/trex_stateless_api.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'src/stateless/trex_stateless_api.h') diff --git a/src/stateless/trex_stateless_api.h b/src/stateless/trex_stateless_api.h index e02e93da..7a9080aa 100644 --- a/src/stateless/trex_stateless_api.h +++ b/src/stateless/trex_stateless_api.h @@ -49,6 +49,20 @@ public: class TrexStatelessPort { public: + struct TrexPortStats { + uint64_t tx_pps; + uint64_t tx_bps; + uint64_t total_tx_pkts; + uint64_t total_tx_bytes; + + uint64_t rx_pps; + uint64_t rx_bps; + uint64_t total_rx_pkts; + uint64_t total_rx_bytes; + + uint64_t tx_rx_errors; + }; + /** * port state */ @@ -96,6 +110,12 @@ public: return m_port_state; } + /** + * port state as string + * + */ + std::string get_state_as_string(); + /** * fill up properties of the port * @@ -149,6 +169,16 @@ public: } + const TrexPortStats & get_port_stats(void) { + /* scrabble */ + m_stats.tx_bps += 1 + rand() % 100; + m_stats.tx_pps += 1 + rand() % 10; + m_stats.total_tx_bytes += 1 + rand() % 10; + m_stats.total_tx_pkts += 1 + rand() % 5; + + return m_stats; + } + private: std::string generate_handler(); @@ -158,6 +188,7 @@ private: port_state_e m_port_state; std::string m_owner; std::string m_owner_handler; + TrexPortStats m_stats; }; /** -- cgit 1.2.3-korg