summaryrefslogtreecommitdiffstats
path: root/src/stateless/trex_stateless_api.h
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2015-09-21 13:46:33 +0300
committerimarom <imarom@cisco.com>2015-09-21 14:26:04 +0300
commit30c686d5de018612cf404520d139a9b5a021ea32 (patch)
tree31f8af4c56c1f497f30204a2e65c24378ab4862c /src/stateless/trex_stateless_api.h
parentf61bbcca4ab21100068887b1a08bf9bdf250f14d (diff)
checkpoint - added stats and some python code
Diffstat (limited to 'src/stateless/trex_stateless_api.h')
-rw-r--r--src/stateless/trex_stateless_api.h31
1 files changed, 31 insertions, 0 deletions
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
*/
@@ -97,6 +111,12 @@ public:
}
/**
+ * port state as string
+ *
+ */
+ std::string get_state_as_string();
+
+ /**
* fill up properties of the port
*
* @author imarom (16-Sep-15)
@@ -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;
};
/**