21 stat_reader::stat_indexes_t stat_reader::m_stat_itf_indexes;
50 stat_reader::registers(
const interface& intf)
52 m_stat_itf_indexes.insert(intf.handle_i().
value());
56 stat_reader::unregisters(
const interface& intf)
58 m_stat_itf_indexes.erase(intf.handle_i().
value());
64 std::set<std::shared_ptr<interface>> itfs_w_stats;
67 for (
auto& sde : sd) {
70 if (sde.name().empty())
75 if (name.find(
"/if") != std::string::npos)
87 data = sde.get_stat_segment_simple_counter_data();
89 for (
auto&
i : m_stat_itf_indexes) {
92 for (
int k = 0; k < m_client.
vec_len(data); k++) {
98 itf->set(count, name);
99 itfs_w_stats.insert(itf);
108 data = sde.get_stat_segment_combined_counter_data();
110 for (
auto&
i : m_stat_itf_indexes) {
113 for (
int k = 0; k < m_client.
vec_len(data); k++) {
120 itf->set(count, name);
121 itfs_w_stats.insert(itf);
128 for (
auto itf : itfs_w_stats) {
129 itf->publish_stats();
stat_reader()
Default Constructor.
uint32_t value() const
get the value of the handle
static std::shared_ptr< interface > find(const handle_t &h)
The the singular instance of the interface in the DB by handle.
virtual void read()
read stats for registered objects from stat_segment and set those stats to respective objects ...
Combined counter to hold both packets and byte differences.
virtual int connect()
connection to stat object
counter_t packets
packet counter
int vec_len(void *vec)
Get vector length of VPP style vector.
void disconnect()
Disconnect to stat segment.
A representation of a stat client in VPP.
~stat_reader()
Destructor.
std::vector< stat_data_t > stat_data_vec_t
vector of stat_data_t
A representation of an interface in VPP.
int connect()
Connect to stat segment.
const stat_data_vec_t & dump()
dump all the stats for given pattern
counter_t bytes
byte counter
The VPP Object Model (VOM) library.
virtual void disconnect()
disconnect to stat object