39 statisticRegistrar.
registerTable<std::uint32_t>(
"TxSlotStatusTable",
55 "Shows the number of Tx slot opportunities that were valid or missed based on slot timing deadlines");
58 statisticRegistrar.
registerTable<std::uint32_t>(
"RxSlotStatusTable",
78 "Shows the number of Rx slot receptions that were valid or missed based on slot timing deadlines");
84 pTxSlotStatusTable_->
clear();
85 pRxSlotStatusTable_->
clear();
87 txSlotCounterMap_.clear();
88 rxSlotCounterMap_.clear();
92 std::uint32_t u32RelativeSlotIndex,
93 std::uint32_t u32RelativeFrameIndex,
95 double dSlotRemainingRatio)
102 updateTx(u32RelativeIndex,
103 u32RelativeSlotIndex,
104 u32RelativeFrameIndex,
106 dSlotRemainingRatio);
116 updateRx(u32RelativeIndex,
117 u32RelativeSlotIndex,
118 u32RelativeFrameIndex,
120 dSlotRemainingRatio);
125 void EMANE::Models::TDMA::SlotStatusTablePublisher::updateTx(std::uint32_t u32RelativeIndex,
126 std::uint32_t u32RelativeSlotIndex,
127 std::uint32_t u32RelativeFrameIndex,
129 double dSlotPortionRatio)
131 auto iter = txSlotCounterMap_.find(u32RelativeIndex);
133 if(iter == txSlotCounterMap_.end())
135 iter = txSlotCounterMap_.insert({u32RelativeIndex,std::make_tuple(0ULL,0ULL,0ULL,std::array<std::uint64_t,8>())}).first;
137 pTxSlotStatusTable_->
addRow(u32RelativeIndex,
138 {
Any{u32RelativeIndex},
139 Any{u32RelativeSlotIndex},
140 Any{u32RelativeFrameIndex},
155 auto & valid = std::get<0>(iter->second);
156 auto & missed = std::get<1>(iter->second);
157 auto & toobig = std::get<2>(iter->second);
158 auto & quantile = std::get<3>(iter->second);
163 pTxSlotStatusTable_->
setCell(u32RelativeIndex,3,
Any{++valid});
166 pTxSlotStatusTable_->
setCell(u32RelativeIndex,4,
Any{++missed});
169 pTxSlotStatusTable_->
setCell(u32RelativeIndex,5,
Any{++toobig});
175 int iQuantileIndex {};
177 if(dSlotPortionRatio <= 0.25)
181 else if(dSlotPortionRatio <= 0.50)
185 else if(dSlotPortionRatio <= 0.75)
189 else if(dSlotPortionRatio <= 1.00)
193 else if(dSlotPortionRatio <= 1.25)
197 else if(dSlotPortionRatio <= 1.50)
201 else if(dSlotPortionRatio <= 1.75)
210 pTxSlotStatusTable_->
setCell(u32RelativeIndex,iQuantileIndex+6,
Any{++quantile[iQuantileIndex]});
213 void EMANE::Models::TDMA::SlotStatusTablePublisher::updateRx(std::uint32_t u32RelativeIndex,
214 std::uint32_t u32RelativeSlotIndex,
215 std::uint32_t u32RelativeFrameIndex,
217 double dSlotPortionRatio)
219 auto iter = rxSlotCounterMap_.find(u32RelativeIndex);
221 if(iter == rxSlotCounterMap_.end())
223 iter = rxSlotCounterMap_.insert({u32RelativeIndex,std::make_tuple(0ULL,0ULL,0ULL,0ULL,0ULL,0ULL,0ULL,std::array<std::uint64_t,8>())}).first;
225 pRxSlotStatusTable_->
addRow(u32RelativeIndex,
226 {
Any{u32RelativeIndex},
227 Any{u32RelativeSlotIndex},
228 Any{u32RelativeFrameIndex},
247 auto & valid = std::get<0>(iter->second);
248 auto & missed = std::get<1>(iter->second);
249 auto & rxidle = std::get<2>(iter->second);
250 auto & rxtx = std::get<3>(iter->second);
251 auto & rxtoolong = std::get<4>(iter->second);
252 auto & rxwrongfreq = std::get<5>(iter->second);
253 auto & rxlock = std::get<6>(iter->second);
254 auto & quantile = std::get<7>(iter->second);
259 pRxSlotStatusTable_->
setCell(u32RelativeIndex,3,
Any{++valid});
262 pRxSlotStatusTable_->
setCell(u32RelativeIndex,4,
Any{++missed});
265 pRxSlotStatusTable_->
setCell(u32RelativeIndex,5,
Any{++rxidle});
268 pRxSlotStatusTable_->
setCell(u32RelativeIndex,6,
Any{++rxtx});
271 pRxSlotStatusTable_->
setCell(u32RelativeIndex,7,
Any{++rxtoolong});
274 pRxSlotStatusTable_->
setCell(u32RelativeIndex,8,
Any{++rxwrongfreq});
277 pRxSlotStatusTable_->
setCell(u32RelativeIndex,9,
Any{++rxlock});
283 int iQuantileIndex {};
285 if(dSlotPortionRatio <= 0.25)
289 else if(dSlotPortionRatio <= 0.50)
293 else if(dSlotPortionRatio <= 0.75)
297 else if(dSlotPortionRatio <= 1.00)
301 else if(dSlotPortionRatio <= 1.25)
305 else if(dSlotPortionRatio <= 1.50)
309 else if(dSlotPortionRatio <= 1.75)
318 pRxSlotStatusTable_->
setCell(u32RelativeIndex,iQuantileIndex+10,
Any{++quantile[iQuantileIndex]});
void registerStatistics(StatisticRegistrar ®istrar)
void setCell(const Key &key, std::size_t columnIndex, const Any &any)
The StatisticRegistrar allows NEM layers to register statistics and statistic tables. Statistics and Statistic tables are owned by the emulator framework and a borrowed reference is returned to the registering NEM layer.
void update(std::uint32_t u32RelativeIndex, std::uint32_t u32RelativeFrameIndex, std::uint32_t u32RelativeSlotIndex, Status status, double dSlotRemainingRatio)
StatisticTable< Key, Compare, scolumn > * registerTable(const std::string &sName, const StatisticTableLabels &labels, const StatisticProperties &properties=StatisticProperties::NONE, const std::string &sDescription="")
void addRow(const Key &key, const std::vector< Any > &anys={})
The Any class can contain an instance of one of any type in its support type set. ...