21 stat_reader::stat_indexes_t stat_reader::m_stat_itf_indexes;
46 stat_reader::registers(
const interface& intf)
48 m_stat_itf_indexes.insert(intf.handle_i().
value());
52 stat_reader::unregisters(
const interface& intf)
54 m_stat_itf_indexes.erase(intf.handle_i().
value());
60 std::set<std::shared_ptr<interface>> itfs_w_stats;
63 for (
auto& sde : sd) {
66 if (sde.name().empty())
71 if (name.find(
"/if") != std::string::npos)
85 data = sde.get_stat_segment_simple_counter_data();
87 for (
auto&
i : m_stat_itf_indexes) {
90 for (
int k = 0; k < m_client.
vec_len(data); k++) {
96 itf->set(count, name);
97 itfs_w_stats.insert(itf);
106 data = sde.get_stat_segment_combined_counter_data();
108 for (
auto&
i : m_stat_itf_indexes) {
111 for (
int k = 0; k < m_client.
vec_len(data); k++) {
118 itf->set(count, name);
119 itfs_w_stats.insert(itf);
126 for (
auto itf : itfs_w_stats) {
127 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