Skip to content

Commit 42ac573

Browse files
committed
app,sched: fix pxsch_rbs_per_tdd_slot_idx + pci
Signed-off-by: Carlo Galiotto <[email protected]>
1 parent b7b7c9e commit 42ac573

File tree

4 files changed

+20
-9
lines changed

4 files changed

+20
-9
lines changed

apps/helpers/metrics/json_generators/du_high/scheduler.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ void to_json(nlohmann::json& json, const scheduler_cell_metrics& metrics)
109109
{
110110
// Cell metrics.
111111
auto& cell_json = json["cell_metrics"];
112+
cell_json["pci"] = metrics.pci;
112113
cell_json["error_indication_count"] = metrics.nof_error_indications;
113114
cell_json["average_latency"] = metrics.average_decision_latency.count();
114115
cell_json["max_latency"] = metrics.max_decision_latency.count();

apps/units/flexible_o_du/o_du_high/du_high/metrics/consumers/scheduler_metrics_consumers.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,13 +229,13 @@ void scheduler_cell_metrics_consumer_log::handle_metric(const std::optional<sche
229229
cell.nof_failed_pdsch_allocs_late_harqs,
230230
cell.nof_failed_pusch_allocs_late_harqs,
231231
cell.pucch_tot_rb_usage_avg);
232-
if (cell.pusch_prbs_used_per_tdd_slot_idx.size()) {
232+
if (not cell.pusch_prbs_used_per_tdd_slot_idx.empty()) {
233233
fmt::format_to(
234234
std::back_inserter(buffer),
235235
" pusch_rbs_per_tdd_slot_idx=[{}]",
236236
fmt::join(cell.pusch_prbs_used_per_tdd_slot_idx.begin(), cell.pusch_prbs_used_per_tdd_slot_idx.end(), ", "));
237237
}
238-
if (cell.pdsch_prbs_used_per_tdd_slot_idx.size()) {
238+
if (not cell.pdsch_prbs_used_per_tdd_slot_idx.empty()) {
239239
fmt::format_to(
240240
std::back_inserter(buffer),
241241
" pdsch_rbs_per_tdd_slot_idx=[{}]",

include/srsran/scheduler/scheduler_metrics.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ struct scheduler_cell_metrics {
169169
std::chrono::microseconds max_decision_latency{0};
170170
slot_point max_decision_latency_slot;
171171
std::array<unsigned, latency_hist_bins> latency_histogram{0};
172-
/// Number of RBs used for PUSCH per slot index in the TDD pattern.
172+
/// Average number of RBs used for PUSCH per slot index in the TDD pattern.
173173
std::vector<unsigned> pusch_prbs_used_per_tdd_slot_idx;
174174
std::vector<unsigned> pdsch_prbs_used_per_tdd_slot_idx;
175175
std::vector<scheduler_cell_event> events;

lib/scheduler/logging/scheduler_metrics_handler.cpp

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -431,13 +431,23 @@ void cell_metrics_handler::report_metrics()
431431
// Note: PUCCH is only allocated on full UL slots.
432432
next_report->pucch_tot_rb_usage_avg =
433433
data.nof_ul_slots > 0 ? static_cast<float>(data.pucch_rbs_used) / data.nof_ul_slots : 0;
434-
for (unsigned rb_count : ul_prbs_used_per_tdd_slot_idx) {
435-
next_report->pusch_prbs_used_per_tdd_slot_idx.push_back(rb_count);
436-
}
437-
for (unsigned rb_count : dl_prbs_used_per_tdd_slot_idx) {
438-
next_report->pdsch_prbs_used_per_tdd_slot_idx.push_back(rb_count);
439-
}
434+
if (cell_cfg.tdd_cfg_common.has_value()) {
435+
const float nof_tdd_periods_per_metric_report =
436+
static_cast<float>(next_report->nof_slots) /
437+
static_cast<float>(nof_slots_per_tdd_period(cell_cfg.tdd_cfg_common.value()));
438+
439+
for (unsigned rb_count : ul_prbs_used_per_tdd_slot_idx) {
440+
const auto avg_nof_rbs =
441+
static_cast<unsigned>(std::round(static_cast<float>(rb_count) / nof_tdd_periods_per_metric_report));
442+
next_report->pusch_prbs_used_per_tdd_slot_idx.push_back(avg_nof_rbs);
443+
}
440444

445+
for (unsigned rb_count : dl_prbs_used_per_tdd_slot_idx) {
446+
const auto avg_nof_rbs =
447+
static_cast<unsigned>(std::round(static_cast<float>(rb_count) / nof_tdd_periods_per_metric_report));
448+
next_report->pdsch_prbs_used_per_tdd_slot_idx.push_back(avg_nof_rbs);
449+
}
450+
}
441451
// Reset cell-wide metric counters.
442452
data = {};
443453

0 commit comments

Comments
 (0)