41 statisticRegistrar.
registerTable<std::uint32_t>(
"scheduler.ScheduleInfoTable",
42 {
"Index",
"Frame",
"Slot",
"Type",
"Frequency",
"Data Rate",
"Power",
"Class",
"Destination"},
44 "Shows the current TDMA schedule.");
47 statisticRegistrar.
registerTable<std::string>(
"scheduler.StructureInfoTable",
50 "Shows the current TDMA structure: slot size, slot overhead, number of slots" 51 " per frame, number of frames per multiframe and transceiver bandwidth.");
56 pStrutureTable_->
clear();
57 pScheduleTable_->
clear();
58 scheduleIndexSet_.clear();
60 bHasStructure_ =
false;
66 pScheduleTable_->
clear();
67 scheduleIndexSet_.clear();
68 structure_ = structure;
70 auto loadStructureTable =
73 (pStrutureTable_->*loadStructureTable)(
"bandwidth",{
Any{
"bandwidth"},
Any{structure.
getBandwidth()}});
79 (pStrutureTable_->*loadStructureTable)(
"slotduration",{
Any{
"slotduration"},
Any{structure.
getSlotDuration().count()}});
81 (pStrutureTable_->*loadStructureTable)(
"slotoverhead",{
Any{
"slotoverhead"},
Any{structure.
getSlotOverhead().count()}});
83 bHasStructure_ =
true;
90 for(
const auto & slotInfo : slotInfos)
93 slotInfo.getFrameIndex() * structure_.
getSlotsPerFrame() + slotInfo.getSlotIndex();
95 std::vector<Any> anys{};
97 switch(slotInfo.getType())
101 Any{slotInfo.getFrameIndex()},
102 Any{slotInfo.getSlotIndex()},
104 Any{slotInfo.getFrequency()},
105 Any{slotInfo.getDataRate()},
106 Any{slotInfo.getPower()},
107 Any{slotInfo.getServiceClass()},
108 Any{slotInfo.getDestination()}};
113 Any{slotInfo.getFrameIndex()},
114 Any{slotInfo.getSlotIndex()},
116 Any{slotInfo.getFrequency()},
125 Any{slotInfo.getFrameIndex()},
126 Any{slotInfo.getSlotIndex()},
136 if(scheduleIndexSet_.count(index))
138 pScheduleTable_->
setRow(index,anys);
142 pScheduleTable_->
addRow(index,anys);
143 scheduleIndexSet_.insert(index);
A two dimentional statistic table that holds Any values.
void replace(const Events::SlotInfos &slotInfos, const Events::SlotStructure &structure)
std::uint32_t getFramesPerMultiFrame() const
void setRow(const Key &key, const std::vector< Any > &anys)
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.
std::uint64_t getBandwidth() const
StatisticTable< Key, Compare, scolumn > * registerTable(const std::string &sName, const StatisticTableLabels &labels, const StatisticProperties &properties=StatisticProperties::NONE, const std::string &sDescription="")
void registerStatistics(StatisticRegistrar ®istrar)
std::uint32_t getSlotsPerFrame() const
const Microseconds & getSlotOverhead() const
void addRow(const Key &key, const std::vector< Any > &anys={})
std::vector< SlotInfo > SlotInfos
The Any class can contain an instance of one of any type in its support type set. ...
void update(const Events::SlotInfos &slotInfos)
const Microseconds & getSlotDuration() const