bugfix - mac logger was being fetched before a sink was assigned, leading to it printing to the console

master
Francisco 4 years ago committed by Francisco Paisana
parent 884c1b04d2
commit d0672d03fb

@ -732,7 +732,7 @@ void sf_sched::set_dl_data_sched_result(const sf_cch_allocator::alloc_result_t&
// Print Resulting DL Allocation
fmt::memory_buffer str_buffer;
fmt::format_to(str_buffer,
"SCHED: DL {} rnti=0x{:x}, cc={}, pid={}, mask={:x}, dci=({}, {}), n_rtx={}, tbs={}, buffer={}/{}",
"SCHED: DL {} rnti=0x{:x}, cc={}, pid={}, mask=0x{:x}, dci=({}, {}), n_rtx={}, tbs={}, buffer={}/{}",
is_newtx ? "tx" : "retx",
user->get_rnti(),
cc_cfg->enb_cc_idx,

@ -28,7 +28,7 @@ using dl_sched_res_t = sched_interface::dl_sched_res_t;
using dl_sched_data_t = sched_interface::dl_sched_data_t;
using custom_mem_buffer = fmt::basic_memory_buffer<char, 1024>;
srslog::basic_logger& get_mac_logger()
static srslog::basic_logger& get_mac_logger()
{
static srslog::basic_logger& mac_logger = srslog::fetch_basic_logger("MAC");
return mac_logger;

@ -20,7 +20,11 @@
namespace srsenb {
static srslog::basic_logger& logger = srslog::fetch_basic_logger("MAC");
static srslog::basic_logger& get_mac_logger()
{
static srslog::basic_logger& logger = srslog::fetch_basic_logger("MAC");
return logger;
}
/// Compute max TBS based on max coderate
int coderate_to_tbs(float max_coderate, uint32_t nof_re)
@ -217,12 +221,12 @@ int generate_ra_bc_dci_format1a_common(srslte_dci_dl_t& dci,
return -1;
}
logger.debug("ra_tbs=%d/%d, tbs_bytes=%d, tbs=%d, mcs=%d",
srslte_ra_tbs_from_idx(mcs, 2),
srslte_ra_tbs_from_idx(mcs, 3),
req_bytes,
tbs,
mcs);
get_mac_logger().debug("ra_tbs=%d/%d, tbs_bytes=%d, tbs=%d, mcs=%d",
srslte_ra_tbs_from_idx(mcs, 2),
srslte_ra_tbs_from_idx(mcs, 3),
req_bytes,
tbs,
mcs);
return tbs;
}
@ -311,7 +315,7 @@ void log_broadcast_allocation(const sched_interface::dl_sched_bc_t& bc,
rbg_interval rbg_range,
const sched_cell_params_t& cell_params)
{
if (not logger.info.enabled()) {
if (not get_mac_logger().info.enabled()) {
return;
}
@ -319,31 +323,31 @@ void log_broadcast_allocation(const sched_interface::dl_sched_bc_t& bc,
fmt::format_to(str_buffer, "{}", rbg_range);
if (bc.type == sched_interface::dl_sched_bc_t::bc_type::BCCH) {
logger.debug("SCHED: SIB%d, cc=%d, rbgs=(%d,%d), dci=(%d,%d), rv=%d, len=%d, period=%d, mcs=%d",
bc.index + 1,
cell_params.enb_cc_idx,
rbg_range.start(),
rbg_range.stop(),
bc.dci.location.L,
bc.dci.location.ncce,
bc.dci.tb[0].rv,
cell_params.cfg.sibs[bc.index].len,
cell_params.cfg.sibs[bc.index].period_rf,
bc.dci.tb[0].mcs_idx);
get_mac_logger().debug("SCHED: SIB%d, cc=%d, rbgs=(%d,%d), dci=(%d,%d), rv=%d, len=%d, period=%d, mcs=%d",
bc.index + 1,
cell_params.enb_cc_idx,
rbg_range.start(),
rbg_range.stop(),
bc.dci.location.L,
bc.dci.location.ncce,
bc.dci.tb[0].rv,
cell_params.cfg.sibs[bc.index].len,
cell_params.cfg.sibs[bc.index].period_rf,
bc.dci.tb[0].mcs_idx);
} else {
logger.info("SCHED: PCH, cc=%d, rbgs=%s, dci=(%d,%d), tbs=%d, mcs=%d",
srslte::to_c_str(str_buffer),
cell_params.enb_cc_idx,
bc.dci.location.L,
bc.dci.location.ncce,
bc.tbs,
bc.dci.tb[0].mcs_idx);
get_mac_logger().info("SCHED: PCH, cc=%d, rbgs=%s, dci=(%d,%d), tbs=%d, mcs=%d",
srslte::to_c_str(str_buffer),
cell_params.enb_cc_idx,
bc.dci.location.L,
bc.dci.location.ncce,
bc.tbs,
bc.dci.tb[0].mcs_idx);
}
}
void log_rar_allocation(const sched_interface::dl_sched_rar_t& rar, rbg_interval rbg_range)
{
if (not logger.info.enabled()) {
if (not get_mac_logger().info.enabled()) {
return;
}
@ -360,12 +364,12 @@ void log_rar_allocation(const sched_interface::dl_sched_rar_t& rar, rbg_interval
rar.msg3_grant[i].grant.trunc_mcs);
}
logger.info("SCHED: RAR, ra-rnti=%d, rbgs=%s, dci=(%d,%d), msg3 grants=[%s]",
rar.dci.rnti,
srslte::to_c_str(str_buffer),
rar.dci.location.L,
rar.dci.location.ncce,
srslte::to_c_str(str_buffer2));
get_mac_logger().info("SCHED: RAR, ra-rnti=%d, rbgs=%s, dci=(%d,%d), msg3 grants=[%s]",
rar.dci.rnti,
srslte::to_c_str(str_buffer),
rar.dci.location.L,
rar.dci.location.ncce,
srslte::to_c_str(str_buffer2));
}
} // namespace srsenb

Loading…
Cancel
Save