diff options
author | Neale Ranns <nranns@cisco.com> | 2018-12-23 06:38:39 -0800 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2018-12-23 16:25:26 +0000 |
commit | d8cf40b8bb5e00eb8b668f7d762e8eb5267a228a (patch) | |
tree | d564e5133eee24279ae6e78d4488ce4ca4c84dfa /extras/vom/vom/interface.cpp | |
parent | e430b6ec123dbe117b579d8284d7201da635be8d (diff) |
VOM: stats
- onnly read when connected. use bool for state
- operator<< for counter_t
- only publish stats for interfaces that have them available
Change-Id: I66a8a336a05912592851c88e3af69155d840a573
Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'extras/vom/vom/interface.cpp')
-rw-r--r-- | extras/vom/vom/interface.cpp | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/extras/vom/vom/interface.cpp b/extras/vom/vom/interface.cpp index 97f7776ebc6..f2f32b43a88 100644 --- a/extras/vom/vom/interface.cpp +++ b/extras/vom/vom/interface.cpp @@ -424,6 +424,8 @@ interface::set(const counter_t& count, const std::string& stat_type) m_stats.m_rx = count; else if ("tx" == stat_type) m_stats.m_tx = count; + else if ("drops" == stat_type) + m_stats.m_drop = count; else if ("rx-unicast" == stat_type) m_stats.m_rx_unicast = count; else if ("tx-unicast" == stat_type) @@ -454,22 +456,12 @@ std::ostream& operator<<(std::ostream& os, const interface::stats_t& stats) { os << "[" - << "rx [packets " << stats.m_rx.packets << ", bytes " << stats.m_rx.bytes - << "]" - << " rx-unicast [packets " << stats.m_rx_unicast.packets << ", bytes " - << stats.m_rx_unicast.bytes << "]" - << " rx-multicast [packets " << stats.m_rx_multicast.packets << ", bytes " - << stats.m_rx_multicast.bytes << "]" - << " rx-broadcast [packets " << stats.m_rx_broadcast.packets << ", bytes " - << stats.m_rx_broadcast.bytes << "]" - << " tx [packets " << stats.m_tx.packets << ", bytes " << stats.m_tx.bytes - << "]" - << " tx-unicast [packets " << stats.m_tx_unicast.packets << ", bytes " - << stats.m_tx_unicast.bytes << "]" - << " tx-multicast [packets " << stats.m_tx_multicast.packets << ", bytes " - << stats.m_tx_multicast.bytes << "]" - << " tx-broadcast [packets " << stats.m_tx_broadcast.packets << ", bytes " - << stats.m_tx_broadcast.bytes << "]]" << std::endl; + << "rx " << stats.m_rx << " rx-unicast " << stats.m_rx_unicast + << " rx-multicast " << stats.m_rx_multicast << " rx-broadcast " + << stats.m_rx_broadcast << " tx " << stats.m_tx << " tx-unicast " + << stats.m_tx_unicast << " tx-multicast " << stats.m_tx_multicast + << " tx-broadcast " << stats.m_tx_broadcast << " drops " << stats.m_drop + << "]" << std::endl; return (os); } |