38 statisticRegistrar.
registerTable<std::uint32_t>(
"TxSlotStatusTable",
39 {
"Index",
"Frame",
"Slot",
"Valid",
"Missed",
"Big",
".25",
".50",
".75",
"1.0",
"1.25",
"1.50",
"1.75",
">1.75"},
41 "Shows the number of Tx slot opportunities that were valid or missed based on slot timing deadlines");
44 statisticRegistrar.
registerTable<std::uint32_t>(
"RxSlotStatusTable",
45 {
"Index",
"Frame",
"Slot",
"Valid",
"Missed",
"Idle",
"Tx",
"Long",
"Freq",
".25",
".50",
".75",
"1.0",
"1.25",
"1.50",
"1.75",
">1.75"},
47 "Shows the number of Rx slot receptions that were valid or missed based on slot timing deadlines");
53 pTxSlotStatusTable_->
clear();
54 pRxSlotStatusTable_->
clear();
56 txSlotCounterMap_.clear();
57 rxSlotCounterMap_.clear();
61 std::uint32_t u32RelativeSlotIndex,
62 std::uint32_t u32RelativeFrameIndex,
64 double dSlotRemainingRatio)
71 updateTx(u32RelativeIndex,
73 u32RelativeFrameIndex,
84 updateRx(u32RelativeIndex,
86 u32RelativeFrameIndex,
93 void EMANE::Models::TDMA::SlotStatusTablePublisher::updateTx(std::uint32_t u32RelativeIndex,
94 std::uint32_t u32RelativeSlotIndex,
95 std::uint32_t u32RelativeFrameIndex,
97 double dSlotRemainingRatio)
99 auto iter = txSlotCounterMap_.find(u32RelativeIndex);
101 if(iter == txSlotCounterMap_.end())
103 iter = txSlotCounterMap_.insert({u32RelativeIndex,std::make_tuple(0ULL,0ULL,0ULL,std::array<std::uint64_t,8>())}).first;
105 pTxSlotStatusTable_->
addRow(u32RelativeIndex,
106 {
Any{u32RelativeIndex},
107 Any{u32RelativeSlotIndex},
108 Any{u32RelativeFrameIndex},
123 auto & valid = std::get<0>(iter->second);
124 auto & missed = std::get<1>(iter->second);
125 auto & toobig = std::get<2>(iter->second);
126 auto & quantile = std::get<3>(iter->second);
131 pTxSlotStatusTable_->
setCell(u32RelativeIndex,3,
Any{++valid});
134 pTxSlotStatusTable_->
setCell(u32RelativeIndex,4,
Any{++missed});
137 pTxSlotStatusTable_->
setCell(u32RelativeIndex,5,
Any{++toobig});
143 double dSlotPassedRatio = 1 - dSlotRemainingRatio;
144 int iQuantileIndex {};
146 if(dSlotPassedRatio <= 0.25)
150 else if(dSlotPassedRatio <= 0.50)
154 else if(dSlotPassedRatio <= 0.75)
158 else if(dSlotPassedRatio <= 1.00)
162 else if(dSlotPassedRatio <= 1.25)
166 else if(dSlotPassedRatio <= 1.50)
170 else if(dSlotPassedRatio <= 1.75)
179 pTxSlotStatusTable_->
setCell(u32RelativeIndex,iQuantileIndex+6,
Any{++quantile[iQuantileIndex]});
182 void EMANE::Models::TDMA::SlotStatusTablePublisher::updateRx(std::uint32_t u32RelativeIndex,
183 std::uint32_t u32RelativeSlotIndex,
184 std::uint32_t u32RelativeFrameIndex,
186 double dSlotRemainingRatio)
188 auto iter = rxSlotCounterMap_.find(u32RelativeIndex);
190 if(iter == rxSlotCounterMap_.end())
192 iter = rxSlotCounterMap_.insert({u32RelativeIndex,std::make_tuple(0ULL,0ULL,0ULL,0ULL,0ULL,0ULL,std::array<std::uint64_t,8>())}).first;
194 pRxSlotStatusTable_->
addRow(u32RelativeIndex,
195 {
Any{u32RelativeIndex},
196 Any{u32RelativeSlotIndex},
197 Any{u32RelativeFrameIndex},
215 auto & valid = std::get<0>(iter->second);
216 auto & missed = std::get<1>(iter->second);
217 auto & rxidle = std::get<2>(iter->second);
218 auto & rxtx = std::get<3>(iter->second);
219 auto & rxtoolong = std::get<4>(iter->second);
220 auto & rxwrongfreq = std::get<5>(iter->second);
221 auto & quantile = std::get<6>(iter->second);
226 pRxSlotStatusTable_->
setCell(u32RelativeIndex,3,
Any{++valid});
229 pRxSlotStatusTable_->
setCell(u32RelativeIndex,4,
Any{++missed});
232 pRxSlotStatusTable_->
setCell(u32RelativeIndex,5,
Any{++rxidle});
235 pRxSlotStatusTable_->
setCell(u32RelativeIndex,6,
Any{++rxtx});
238 pRxSlotStatusTable_->
setCell(u32RelativeIndex,7,
Any{++rxtoolong});
241 pRxSlotStatusTable_->
setCell(u32RelativeIndex,8,
Any{++rxwrongfreq});
248 double dSlotPassedRatio{dSlotRemainingRatio};
250 if(dSlotRemainingRatio < 1)
252 dSlotPassedRatio = 1 - dSlotRemainingRatio;
255 int iQuantileIndex {};
257 if(dSlotPassedRatio <= 0.25)
261 else if(dSlotPassedRatio <= 0.50)
265 else if(dSlotPassedRatio <= 0.75)
269 else if(dSlotPassedRatio <= 1.00)
273 else if(dSlotPassedRatio <= 1.25)
277 else if(dSlotPassedRatio <= 1.50)
281 else if(dSlotPassedRatio <= 1.75)
290 pRxSlotStatusTable_->
setCell(u32RelativeIndex,iQuantileIndex+9,
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. ...