Skip to content

Commit

Permalink
Merge branch 'trace_resource_usage_part2' into fix_sched_ue_rem
Browse files Browse the repository at this point in the history
  • Loading branch information
Ismael committed Oct 29, 2024
2 parents 10edbde + 9131f44 commit d7e21c3
Show file tree
Hide file tree
Showing 7 changed files with 201 additions and 88 deletions.
1 change: 1 addition & 0 deletions include/srsran/scheduler/scheduler_feedback_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ struct uci_indication {

struct srs_indication {
struct srs_indication_pdu {
srs_indication_pdu() = default;
srs_indication_pdu(const du_ue_index_t ue_idx,
const rnti_t ue_rnti_,
std::optional<phy_time_unit> ta,
Expand Down
12 changes: 10 additions & 2 deletions lib/scheduler/cell_scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,10 @@ void cell_scheduler::handle_crc_indication(const ul_crc_indication& crc_ind)

void cell_scheduler::run_slot(slot_point sl_tx)
{
using namespace std::chrono;

// Mark the start of the slot.
auto slot_start_tp = std::chrono::high_resolution_clock::now();
auto slot_start_tp = high_resolution_clock::now();
res_usage_tracer.start();

// If there are skipped slots, handle them. Otherwise, the cell grid and cached results are not correctly cleared.
Expand All @@ -103,6 +105,10 @@ void cell_scheduler::run_slot(slot_point sl_tx)
pucch_alloc.slot_indication(sl_tx);
uci_alloc.slot_indication(sl_tx);

auto stop_tp1 = high_resolution_clock::now();
res_usage_tracer.stop("slot_prep", duration_cast<microseconds>(stop_tp1 - slot_start_tp));
res_usage_tracer.start();

// > SSB scheduling.
ssb_sch.run_slot(res_grid, sl_tx);

Expand All @@ -125,13 +131,15 @@ void cell_scheduler::run_slot(slot_point sl_tx)
// > Schedule Paging.
pg_sch.run_slot(res_grid);

auto stop_tp2 = high_resolution_clock::now();
res_usage_tracer.stop("slot_common", duration_cast<microseconds>(stop_tp2 - stop_tp1));

// > Schedule UE DL and UL data.
ue_sched.run_slot(sl_tx);

// > Mark stop of the slot processing
auto slot_stop_tp = std::chrono::high_resolution_clock::now();
auto slot_dur = std::chrono::duration_cast<std::chrono::microseconds>(slot_stop_tp - slot_start_tp);
res_usage_tracer.stop(slot_dur);

// > Log processed events.
event_logger.log();
Expand Down
10 changes: 7 additions & 3 deletions lib/scheduler/logging/scheduler_tracer.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,17 @@ class scheduler_slot_tracer
}

/// \brief If the slot latency is greater than \c log_warn_thres, a warning logged with resource usage metrics.
void stop(std::chrono::microseconds slot_dur)
void stop(const char* section_name, std::chrono::microseconds slot_dur)
{
if (active() and slot_dur > log_warn_thres) {
auto slot_stop_resusage = resource_usage::now().value();
diff_resusage = slot_stop_resusage - slot_start_resusage;

logger.warning("cell={}: High latency detected. Latency={}usec {}", cell_index, slot_dur.count(), diff_resusage);
logger.warning("cell={}: High latency detected in {}. Latency={}usec {}",
cell_index,
section_name,
slot_dur.count(),
diff_resusage);
}
}

Expand All @@ -61,4 +65,4 @@ class scheduler_slot_tracer
resource_usage::diff diff_resusage;
};

} // namespace srsran
} // namespace srsran
Loading

0 comments on commit d7e21c3

Please sign in to comment.