Skip to content

Commit 2965aee

Browse files
committed
e2sm_kpm: adding support for DRB.AirIfDelayUl metric
1 parent 126717a commit 2965aee

File tree

11 files changed

+80
-16
lines changed

11 files changed

+80
-16
lines changed

include/srsran/scheduler/scheduler_metrics.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ struct scheduler_ue_metrics {
3636
sch_mcs_index ul_mcs;
3737
double ul_prbs_used;
3838
double ul_brate_kbps;
39+
double ul_delay_ms;
3940
unsigned ul_nof_ok;
4041
unsigned ul_nof_nok;
4142
unsigned bsr;

lib/e2/e2sm/e2sm_kpm/e2sm_kpm_du_meas_provider_impl.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ e2sm_kpm_du_meas_provider_impl::e2sm_kpm_du_meas_provider_impl(srs_du::f1ap_ue_i
7474
e2sm_kpm_supported_metric_t{
7575
NO_LABEL, ALL_LEVELS, true, &e2sm_kpm_du_meas_provider_impl::get_drb_rlc_sdu_transmitted_volume_ul});
7676

77+
supported_metrics.emplace(
78+
"DRB.AirIfDelayUl",
79+
e2sm_kpm_supported_metric_t{NO_LABEL, ALL_LEVELS, true, &e2sm_kpm_du_meas_provider_impl::get_delay_ul});
80+
7781
// Check if the supported metrics are matching e2sm_kpm metrics definitions.
7882
check_e2sm_kpm_metrics_definitions(get_e2sm_kpm_28_552_metrics());
7983
check_e2sm_kpm_metrics_definitions(get_e2sm_kpm_oran_metrics());
@@ -337,6 +341,7 @@ bool e2sm_kpm_du_meas_provider_impl::get_rsrq(const asn1::e2sm::label_info_list_
337341

338342
return meas_collected;
339343
}
344+
340345
bool e2sm_kpm_du_meas_provider_impl::get_prb_avail_dl(const asn1::e2sm::label_info_list_l label_info_list,
341346
const std::vector<asn1::e2sm::ue_id_c>& ues,
342347
const std::optional<asn1::e2sm::cgi_c> cell_global_id,
@@ -428,6 +433,24 @@ bool e2sm_kpm_du_meas_provider_impl::get_prb_use_perc_ul(const asn1::e2sm::label
428433

429434
return meas_collected;
430435
}
436+
bool e2sm_kpm_du_meas_provider_impl::get_delay_ul(const asn1::e2sm::label_info_list_l label_info_list,
437+
const std::vector<asn1::e2sm::ue_id_c>& ues,
438+
const std::optional<asn1::e2sm::cgi_c> cell_global_id,
439+
std::vector<asn1::e2sm::meas_record_item_c>& items)
440+
{
441+
bool meas_collected = false;
442+
scheduler_ue_metrics ue_metrics = last_ue_metrics[0];
443+
if ((label_info_list.size() > 1 or
444+
(label_info_list.size() == 1 and not label_info_list[0].meas_label.no_label_present))) {
445+
logger.debug("Metric: DRB.AirIfDelayUl supports only NO_LABEL label.");
446+
return meas_collected;
447+
}
448+
meas_record_item_c meas_record_item;
449+
meas_record_item.set_real().value = ue_metrics.ul_delay_ms;
450+
items.push_back(meas_record_item);
451+
meas_collected = true;
452+
return meas_collected;
453+
}
431454

432455
float e2sm_kpm_du_meas_provider_impl::bytes_to_kbits(float value)
433456
{

lib/e2/e2sm/e2sm_kpm/e2sm_kpm_du_meas_provider_impl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ class e2sm_kpm_du_meas_provider_impl : public e2sm_kpm_meas_provider, public e2_
9090
metric_meas_getter_func_t get_prb_avail_ul;
9191
metric_meas_getter_func_t get_prb_use_perc_dl;
9292
metric_meas_getter_func_t get_prb_use_perc_ul;
93+
metric_meas_getter_func_t get_delay_ul;
9394
metric_meas_getter_func_t get_drb_ul_success_rate;
9495
metric_meas_getter_func_t get_drb_rlc_packet_drop_rate_dl;
9596
metric_meas_getter_func_t get_drb_rlc_sdu_transmitted_volume_dl;

lib/scheduler/config/sched_config_manager.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,11 @@ void sched_config_manager::handle_ue_config_complete(du_ue_index_t ue_index, std
192192

193193
if (ue_cfg_list[ue_index] == nullptr) {
194194
// UE creation case.
195-
metrics_handler.handle_ue_creation(
196-
ue_index, next_cfg->crnti, next_cfg->pcell_common_cfg().pci, next_cfg->pcell_common_cfg().nof_dl_prbs);
195+
metrics_handler.handle_ue_creation(ue_index,
196+
next_cfg->crnti,
197+
next_cfg->pcell_common_cfg().pci,
198+
next_cfg->pcell_common_cfg().nof_dl_prbs,
199+
next_cfg->pcell_common_cfg().nof_slots_per_frame);
197200
}
198201

199202
// Stores new UE config and deletes old config.

lib/scheduler/logging/scheduler_metric_handler.cpp

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,15 @@ scheduler_metrics_handler::scheduler_metrics_handler(msecs
2121
void scheduler_metrics_handler::handle_ue_creation(du_ue_index_t ue_index,
2222
rnti_t rnti,
2323
pci_t pcell_pci,
24-
unsigned num_prbs)
24+
unsigned num_prbs,
25+
unsigned num_slots_per_frame)
2526
{
2627
ues.emplace(ue_index);
27-
ues[ue_index].rnti = rnti;
28-
ues[ue_index].ue_index = ue_index;
29-
ues[ue_index].pci = pcell_pci;
30-
ues[ue_index].nof_prbs = num_prbs;
28+
ues[ue_index].rnti = rnti;
29+
ues[ue_index].ue_index = ue_index;
30+
ues[ue_index].pci = pcell_pci;
31+
ues[ue_index].nof_prbs = num_prbs;
32+
ues[ue_index].num_slots_per_frame = num_slots_per_frame;
3133
rnti_to_ue_index_lookup.emplace(rnti, ue_index);
3234
}
3335

@@ -253,6 +255,13 @@ void scheduler_metrics_handler::handle_slot_result(const sched_result& slo
253255
decision_latency_hist[bin_idx]++;
254256
}
255257

258+
void scheduler_metrics_handler::handle_ul_delay(du_ue_index_t ue_index, double delay)
259+
{
260+
if (ues.contains(ue_index)) {
261+
ues[ue_index].data.sum_ul_delay_ms += delay * (10 / (ues[ue_index].num_slots_per_frame));
262+
}
263+
}
264+
256265
void scheduler_metrics_handler::push_result(slot_point sl_tx,
257266
const sched_result& slot_result,
258267
std::chrono::microseconds slot_decision_latency)
@@ -297,6 +306,7 @@ scheduler_metrics_handler::ue_metric_context::compute_report(std::chrono::millis
297306
ret.pusch_rsrp_db = data.nof_pusch_rsrp_reports > 0 ? data.sum_pusch_rsrp / data.nof_pusch_rsrp_reports
298307
: -std::numeric_limits<float>::infinity();
299308
ret.pucch_snr_db = data.nof_pucch_snr_reports > 0 ? data.sum_pucch_snrs / data.nof_pucch_snr_reports : 0;
309+
ret.ul_delay_ms = data.sum_ul_delay_ms / data.count_crc_pdus;
300310
ret.bsr = last_bsr;
301311
ret.dl_bs = 0;
302312
for (const unsigned value : last_dl_bs) {

lib/scheduler/logging/scheduler_metrics_handler.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ class scheduler_metrics_handler final : public harq_timeout_handler, public sche
4242
double sum_pusch_snrs = 0;
4343
double sum_pucch_snrs = 0;
4444
double sum_pusch_rsrp = 0;
45+
double sum_ul_delay_ms = 0;
4546
unsigned nof_pucch_snr_reports = 0;
4647
unsigned nof_pusch_snr_reports = 0;
4748
unsigned nof_pusch_rsrp_reports = 0;
@@ -59,6 +60,7 @@ class scheduler_metrics_handler final : public harq_timeout_handler, public sche
5960

6061
pci_t pci;
6162
unsigned nof_prbs;
63+
unsigned num_slots_per_frame;
6264
du_ue_index_t ue_index;
6365
rnti_t rnti;
6466
unsigned last_bsr = 0;
@@ -93,7 +95,11 @@ class scheduler_metrics_handler final : public harq_timeout_handler, public sche
9395
explicit scheduler_metrics_handler(msecs metrics_report_period, scheduler_metrics_notifier& notifier);
9496

9597
/// \brief Register creation of a UE.
96-
void handle_ue_creation(du_ue_index_t ue_index, rnti_t rnti, pci_t pcell_pci, unsigned num_prbs) override;
98+
void handle_ue_creation(du_ue_index_t ue_index,
99+
rnti_t rnti,
100+
pci_t pcell_pci,
101+
unsigned num_prbs,
102+
unsigned num_slots_per_frame) override;
97103

98104
/// \brief Register removal of a UE.
99105
void handle_ue_deletion(du_ue_index_t ue_index) override;
@@ -122,6 +128,8 @@ class scheduler_metrics_handler final : public harq_timeout_handler, public sche
122128
/// \brief Handle Error Indication reported to the scheduler for a given cell.
123129
void handle_error_indication();
124130

131+
void handle_ul_delay(du_ue_index_t ue_index, double delay);
132+
125133
/// \brief Handle results stored in the scheduler result and push new entry.
126134
void push_result(slot_point sl_tx, const sched_result& slot_result, std::chrono::microseconds slot_decision_latency);
127135

lib/scheduler/logging/scheduler_metrics_ue_configurator.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ class sched_metrics_ue_configurator
2323
virtual ~sched_metrics_ue_configurator() = default;
2424

2525
/// Adds a new UE to the reported metrics.
26-
virtual void handle_ue_creation(du_ue_index_t ue_index, rnti_t rnti, pci_t pcell_pci, unsigned num_prbs) = 0;
26+
virtual void handle_ue_creation(du_ue_index_t ue_index,
27+
rnti_t rnti,
28+
pci_t pcell_pci,
29+
unsigned num_prbs,
30+
unsigned num_slots_per_frame) = 0;
2731

2832
/// Removes a UE from the reported metrics.
2933
virtual void handle_ue_deletion(du_ue_index_t ue_index) = 0;

lib/scheduler/ue_scheduling/ue_event_manager.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,11 +303,11 @@ void ue_event_manager::handle_ul_phr_indication(const ul_phr_indication_message&
303303
void ue_event_manager::handle_crc_indication(const ul_crc_indication& crc_ind)
304304
{
305305
srsran_assert(cell_exists(crc_ind.cell_index), "Invalid cell index");
306-
306+
int slot_delay = last_sl - crc_ind.sl_rx;
307307
for (unsigned i = 0, e = crc_ind.crcs.size(); i != e; ++i) {
308308
cell_specific_events[crc_ind.cell_index].emplace(
309309
crc_ind.crcs[i].ue_index,
310-
[this, sl_rx = crc_ind.sl_rx, crc = crc_ind.crcs[i]](ue_cell& ue_cc) {
310+
[this, slot_delay, sl_rx = crc_ind.sl_rx, crc = crc_ind.crcs[i]](ue_cell& ue_cc) {
311311
const int tbs = ue_cc.handle_crc_pdu(sl_rx, crc);
312312
if (tbs < 0) {
313313
return;
@@ -325,6 +325,7 @@ void ue_event_manager::handle_crc_indication(const ul_crc_indication& crc_ind)
325325

326326
// Notify metrics handler.
327327
metrics_handler.handle_crc_indication(crc, units::bytes{(unsigned)tbs});
328+
metrics_handler.handle_ul_delay(crc.ue_index, slot_delay);
328329
},
329330
"CRC",
330331
true);

tests/unittests/scheduler/scheduler_metrics_handler_test.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class scheduler_metrics_handler_tester : public ::testing::Test
2929
std::chrono::milliseconds period = std::chrono::milliseconds{test_rgen::uniform_int<unsigned>(2, 100)}) :
3030
report_period(period), metrics(period, metrics_notif)
3131
{
32-
metrics.handle_ue_creation(test_ue_index, to_rnti(0x4601), pci_t{0}, nof_prbs);
32+
metrics.handle_ue_creation(test_ue_index, to_rnti(0x4601), pci_t{0}, nof_prbs, num_slots_per_frame);
3333
}
3434

3535
void run_slot(const sched_result& sched_res, std::chrono::microseconds latency = std::chrono::microseconds{0})
@@ -54,8 +54,9 @@ class scheduler_metrics_handler_tester : public ::testing::Test
5454
du_ue_index_t test_ue_index = to_du_ue_index(test_rgen::uniform_int<unsigned>(0, MAX_NOF_DU_UES - 1));
5555

5656
slot_point next_sl_tx{0, test_rgen::uniform_int<unsigned>(0, 10239)};
57-
unsigned slot_count = 0;
58-
unsigned nof_prbs = 100;
57+
unsigned slot_count = 0;
58+
unsigned nof_prbs = 100;
59+
unsigned num_slots_per_frame = 10;
5960
};
6061

6162
TEST_F(scheduler_metrics_handler_tester, metrics_sent_with_defined_periodicity)

tests/unittests/scheduler/test_utils/config_generators.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,13 @@ class dummy_scheduler_ue_metrics_notifier : public scheduler_metrics_notifier
3232
class dummy_sched_metrics_ue_configurator : public sched_metrics_ue_configurator
3333
{
3434
public:
35-
void handle_ue_creation(du_ue_index_t ue_index, rnti_t rnti, pci_t pcell_pci, unsigned num_prbs) override {}
35+
void handle_ue_creation(du_ue_index_t ue_index,
36+
rnti_t rnti,
37+
pci_t pcell_pci,
38+
unsigned num_prbs,
39+
unsigned num_slots_per_frame) override
40+
{
41+
}
3642
void handle_ue_deletion(du_ue_index_t ue_index) override {}
3743
};
3844

0 commit comments

Comments
 (0)