40 struct hash<std::pair<std::string,EMANE::EventId>>
42 typedef std::pair<std::string,EMANE::EventId> argument_type;
43 typedef std::size_t result_type;
45 result_type operator()(argument_type
const& s)
const 47 result_type
const h1{std::hash<std::string>()(s.first)};
48 result_type
const h2{std::hash<EMANE::EventId>()(s.second)};
49 return h1 ^ (h2 << 1);
66 EVENT_COUNT_COLUMN_EVENT = 0,
67 EVENT_COUNT_COLUMN_UUID = 1,
68 EVENT_COUNT_COLUMN_NUM_EVENTS_TX = 2,
69 EVENT_COUNT_COLUMN_NUM_EVENTS_RX = 3,
79 statisticRegistrar.registerNumeric<std::uint64_t>(
"num" + sPrefix +
"EventsTx",
82 statisticRegistrar.registerNumeric<std::uint64_t>(
"num" + sPrefix +
"EventsRx",
85 statisticRegistrar.registerTable<EventCountTableKey>(sPrefix +
"EventCountTable",
89 std::lock_guard<std::mutex> m(mutexEventCountTable_);
90 eventCountInfo_.clear();
93 sPrefix +
" Event count table.");
99 uuid_unparse(uuid,buf);
100 auto key = EventCountTableKey{buf,eventId};
102 std::lock_guard<std::mutex> m(mutexEventCountTable_);
104 auto iter = eventCountInfo_.find(key);
106 if(iter == eventCountInfo_.end())
108 if(eventCountInfo_.size() < rowLimit_)
110 iter = eventCountInfo_.insert({key,std::make_tuple(0,0)}).first;
112 pEventCountTable_->
addRow(key,
125 if(iter != eventCountInfo_.end())
127 auto & events = std::get<EVENT_COUNT_COLUMN_NUM_EVENTS_RX-2>(iter->second);
131 pEventCountTable_->
setCell(key,
132 EVENT_COUNT_COLUMN_NUM_EVENTS_RX,
141 if(iter != eventCountInfo_.end())
143 auto & events = std::get<EVENT_COUNT_COLUMN_NUM_EVENTS_TX-2>(iter->second);
147 pEventCountTable_->
setCell(key,
148 EVENT_COUNT_COLUMN_NUM_EVENTS_TX,
A StatisticTablePublisher produces two dimensional tables of Anys.
void setCell(const Key &key, std::size_t columnIndex, const Any &any)
void update(Type type, const uuid_t &uuid, EventId eventId)
std::vector< std::string > StatisticTableLabels
void setRowLimit(size_t rows)
void addRow(const Key &key, const std::vector< Any > &anys={})
EventStatisticPublisher(const std::string &sPrefix)
static StatisticService * instance()
The Any class can contain an instance of one of any type in its support type set. ...