40 struct hash<
std::pair<std::string,EMANE::NEMId>>
42 typedef std::pair<std::string,EMANE::NEMId> 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::NEMId>()(s.second)};
49 return h1 ^ (h2 << 1);
66 PACKET_COUNT_COLUMN_NEM = 0,
67 PACKET_COUNT_COLUMN_UUID = 1,
68 PACKET_COUNT_COLUMN_NUM_PACKETS_TX = 2,
69 PACKET_COUNT_COLUMN_NUM_PACKETS_RX = 3,
78 pNumOTAChannelDownstreamPackets_ =
79 statisticRegistrar.registerNumeric<std::uint64_t>(
"numOTAChannelDownstreamPackets",
81 pNumOTAChannelUpstreamPackets_ =
82 statisticRegistrar.registerNumeric<std::uint64_t>(
"numOTAChannelUpstreamPackets",
85 statisticRegistrar.registerTable<PacketCountTableKey>(
"OTAChannelPacketCountTable",
89 std::lock_guard<std::mutex> m(mutexPacketCountTable_);
90 packetCountInfo_.clear();
93 "OTA packet count table.");
99 uuid_unparse(uuid,buf);
100 auto key = PacketCountTableKey{buf,nemId};
102 std::lock_guard<std::mutex> m(mutexPacketCountTable_);
104 auto iter = packetCountInfo_.find(key);
106 if(iter == packetCountInfo_.end())
108 if(packetCountInfo_.size() < rowLimit_)
110 iter = packetCountInfo_.insert({key,std::make_tuple(0,0)}).first;
112 pPacketCountTable_->
addRow(key,
122 ++*pNumOTAChannelUpstreamPackets_;
124 if(iter != packetCountInfo_.end())
126 auto & packets = std::get<PACKET_COUNT_COLUMN_NUM_PACKETS_RX-2>(iter->second);
130 pPacketCountTable_->
setCell(key,
131 PACKET_COUNT_COLUMN_NUM_PACKETS_RX,
138 ++*pNumOTAChannelDownstreamPackets_;
140 if(iter != packetCountInfo_.end())
142 auto & packets = std::get<PACKET_COUNT_COLUMN_NUM_PACKETS_TX-2>(iter->second);
146 pPacketCountTable_->
setCell(key,
147 PACKET_COUNT_COLUMN_NUM_PACKETS_TX,
A StatisticTablePublisher produces two dimensional tables of Anys.
void setCell(const Key &key, std::size_t columnIndex, const Any &any)
void setRowLimit(size_t rows)
void update(Type type, const uuid_t &uuid, NEMId nemId)
std::vector< std::string > StatisticTableLabels
void addRow(const Key &key, const std::vector< Any > &anys={})
static StatisticService * instance()
The Any class can contain an instance of one of any type in its support type set. ...