Adapt the enb metrics to allow adding a PCI field for each CC.

Include the PCI field in the enb JSON metrics.
master
faluco 3 years ago committed by faluco
parent fd013e8a17
commit fdb4b91e98

@ -37,10 +37,18 @@ struct mac_ue_metrics_t {
float phr; float phr;
}; };
/// MAC misc information for each cc.
struct mac_cc_info_t {
/// PCI value.
uint32_t pci;
/// RACH preamble counter per cc.
uint32_t cc_rach_counter;
};
/// Main MAC metrics. /// Main MAC metrics.
struct mac_metrics_t { struct mac_metrics_t {
/// RACH preamble counter per cc. /// Per CC info.
std::vector<uint32_t> cc_rach_counter; std::vector<mac_cc_info_t> cc_info;
/// Per UE MAC metrics. /// Per UE MAC metrics.
std::vector<mac_ue_metrics_t> ues; std::vector<mac_ue_metrics_t> ues;
}; };

@ -70,19 +70,20 @@ DECLARE_METRIC_SET("ue_container",
metric_bsr, metric_bsr,
mlist_bearers); mlist_bearers);
/// Sector container metrics. /// Cell container metrics.
DECLARE_METRIC("sector_id", metric_sector_id, uint32_t, ""); DECLARE_METRIC("sector_id", metric_sector_id, uint32_t, "");
DECLARE_METRIC("sector_rach", metric_sector_rach, uint32_t, ""); DECLARE_METRIC("pci", metric_pci, uint32_t, "");
DECLARE_METRIC("nof_rach", metric_nof_rach, uint32_t, "");
DECLARE_METRIC_LIST("ue_list", mlist_ues, std::vector<mset_ue_container>); DECLARE_METRIC_LIST("ue_list", mlist_ues, std::vector<mset_ue_container>);
DECLARE_METRIC_SET("sector_container", mset_sector_container, metric_sector_id, metric_sector_rach, mlist_ues); DECLARE_METRIC_SET("cell_container", mset_cell_container, metric_sector_id, metric_pci, metric_nof_rach, mlist_ues);
/// Metrics root object. /// Metrics root object.
DECLARE_METRIC("type", metric_type_tag, std::string, ""); DECLARE_METRIC("type", metric_type_tag, std::string, "");
DECLARE_METRIC("timestamp", metric_timestamp_tag, double, ""); DECLARE_METRIC("timestamp", metric_timestamp_tag, double, "");
DECLARE_METRIC_LIST("sector_list", mlist_sector, std::vector<mset_sector_container>); DECLARE_METRIC_LIST("cell_list", mlist_cell, std::vector<mset_cell_container>);
/// Metrics context. /// Metrics context.
using metric_context_t = srslog::build_context_type<metric_type_tag, metric_timestamp_tag, mlist_sector>; using metric_context_t = srslog::build_context_type<metric_type_tag, metric_timestamp_tag, mlist_cell>;
} // namespace } // namespace
@ -170,7 +171,7 @@ void metrics_json::set_metrics(const enb_metrics_t& m, const uint32_t period_use
if (!enb) { if (!enb) {
return; return;
} }
if (m.stack.mac.cc_rach_counter.empty()) { if (m.stack.mac.cc_info.empty()) {
return; return;
} }
@ -178,27 +179,28 @@ void metrics_json::set_metrics(const enb_metrics_t& m, const uint32_t period_use
// Fill root object. // Fill root object.
ctx.write<metric_type_tag>("metrics"); ctx.write<metric_type_tag>("metrics");
auto& sector_list = ctx.get<mlist_sector>(); auto& cell_list = ctx.get<mlist_cell>();
sector_list.resize(m.stack.mac.cc_rach_counter.size()); cell_list.resize(m.stack.mac.cc_info.size());
// For each sector... // For each cell...
for (unsigned cc_idx = 0, e = sector_list.size(); cc_idx != e; ++cc_idx) { for (unsigned cc_idx = 0, e = cell_list.size(); cc_idx != e; ++cc_idx) {
auto& sector = sector_list[cc_idx]; auto& cell = cell_list[cc_idx];
sector.write<metric_sector_id>(cc_idx); cell.write<metric_sector_id>(cc_idx);
sector.write<metric_sector_rach>(m.stack.mac.cc_rach_counter[cc_idx]); cell.write<metric_nof_rach>(m.stack.mac.cc_info[cc_idx].cc_rach_counter);
cell.write<metric_pci>(m.stack.mac.cc_info[cc_idx].pci);
// For each UE in this sector... // For each UE in this cell...
for (unsigned i = 0; i != m.stack.rrc.ues.size(); ++i) { for (unsigned i = 0; i != m.stack.rrc.ues.size(); ++i) {
if (!has_valid_metric_ranges(m, i)) { if (!has_valid_metric_ranges(m, i)) {
continue; continue;
} }
// Only record UEs that belong to this sector. // Only record UEs that belong to this cell.
if (m.stack.mac.ues[i].cc_idx != cc_idx) { if (m.stack.mac.ues[i].cc_idx != cc_idx) {
continue; continue;
} }
sector.get<mlist_ues>().emplace_back(); cell.get<mlist_ues>().emplace_back();
fill_ue_metrics(sector.get<mlist_ues>().back(), m, i); fill_ue_metrics(cell.get<mlist_ues>().back(), m, i);
} }
} }

@ -244,7 +244,11 @@ void mac::get_metrics(mac_metrics_t& metrics)
metrics.ues.emplace_back(); metrics.ues.emplace_back();
u.second->metrics_read(&metrics.ues.back()); u.second->metrics_read(&metrics.ues.back());
} }
metrics.cc_rach_counter = detected_rachs; metrics.cc_info.resize(detected_rachs.size());
for (unsigned cc = 0, e = detected_rachs.size(); cc != e; ++cc) {
metrics.cc_info[cc].cc_rach_counter = detected_rachs[cc];
metrics.cc_info[cc].pci = (cc < cell_config.size()) ? cell_config[cc].cell.id : 0;
}
} }
void mac::toggle_padding() void mac::toggle_padding()

@ -713,6 +713,7 @@ void rrc::config_mac()
// Copy base cell configuration // Copy base cell configuration
item.cell = cfg.cell; item.cell = cfg.cell;
item.cell.id = cfg.cell_list[ccidx].pci;
// copy secondary cell list info // copy secondary cell list info
sched_cfg[ccidx].scell_list.reserve(cfg.cell_list[ccidx].scell_list.size()); sched_cfg[ccidx].scell_list.reserve(cfg.cell_list[ccidx].scell_list.size());

Loading…
Cancel
Save