remove uneeded formatting and std::string creation/allocation in scheduler

master
Francisco 4 years ago committed by Francisco Paisana
parent 2ecdab8717
commit 770021e364

@ -55,7 +55,7 @@ public:
int get_bsr_with_overhead(uint32_t lcid) const; int get_bsr_with_overhead(uint32_t lcid) const;
int get_max_prio_lcid() const; int get_max_prio_lcid() const;
std::string get_bsr_text() const; const std::array<int, 4>& get_bsr_state() const;
// Control Element Command queue // Control Element Command queue
using ce_cmd = srslte::dl_sch_lcid; using ce_cmd = srslte::dl_sch_lcid;

@ -15,8 +15,9 @@
#include "srsenb/hdr/stack/mac/sched.h" #include "srsenb/hdr/stack/mac/sched.h"
#include "srsenb/hdr/stack/mac/sched_helpers.h" #include "srsenb/hdr/stack/mac/sched_helpers.h"
#include "srsenb/hdr/stack/mac/sched_ue.h" #include "srsenb/hdr/stack/mac/sched_ue.h"
#include "srslte/common/log_helper.h"
#include "srslte/common/logmap.h" #include "srslte/common/logmap.h"
#include "srslte/common/string_helpers.h"
#include "srslte/srslog/bundled/fmt/ranges.h"
using srslte::tti_interval; using srslte::tti_interval;
@ -942,10 +943,14 @@ uint32_t sched_ue::get_pending_ul_new_data(tti_point tti_tx_ul, int this_enb_cc_
pending_data = (pending_data > pending_ul_data) ? pending_data - pending_ul_data : 0; pending_data = (pending_data > pending_ul_data) ? pending_data - pending_ul_data : 0;
if (pending_data > 0) { if (pending_data > 0) {
logger.debug("SCHED: pending_data=%d, in_harq_data=%d, bsr=%s", if (logger.debug.enabled()) {
pending_data, fmt::memory_buffer str_buffer;
pending_ul_data, fmt::format_to(str_buffer, "{}", lch_handler.get_bsr_state());
lch_handler.get_bsr_text().c_str()); logger.debug("SCHED: pending_data=%d, in_harq_data=%d, bsr=%s",
pending_data,
pending_ul_data,
srslte::to_c_str(str_buffer));
}
} }
return pending_data; return pending_data;
} }

@ -12,7 +12,8 @@
#include "srsenb/hdr/stack/mac/sched_ue_ctrl/sched_lch.h" #include "srsenb/hdr/stack/mac/sched_ue_ctrl/sched_lch.h"
#include "srsenb/hdr/stack/mac/sched_helpers.h" #include "srsenb/hdr/stack/mac/sched_helpers.h"
#include "srslte/common/log_helper.h" #include "srslte/common/string_helpers.h"
#include "srslte/srslog/bundled/fmt/ranges.h"
namespace srsenb { namespace srsenb {
@ -110,7 +111,11 @@ void lch_ue_manager::ul_bsr(uint8_t lcg_id, uint32_t bsr)
return; return;
} }
lcg_bsr[lcg_id] = bsr; lcg_bsr[lcg_id] = bsr;
logger.debug("SCHED: bsr=%d, lcg_id=%d, bsr=%s", bsr, lcg_id, get_bsr_text().c_str()); if (logger.debug.enabled()) {
fmt::memory_buffer str_buffer;
fmt::format_to(str_buffer, "{}", get_bsr_state());
logger.debug("SCHED: bsr=%d, lcg_id=%d, bsr=%s", bsr, lcg_id, srslte::to_c_str(str_buffer));
}
} }
void lch_ue_manager::ul_buffer_add(uint8_t lcid, uint32_t bytes) void lch_ue_manager::ul_buffer_add(uint8_t lcid, uint32_t bytes)
@ -120,7 +125,12 @@ void lch_ue_manager::ul_buffer_add(uint8_t lcid, uint32_t bytes)
return; return;
} }
lcg_bsr[lch[lcid].cfg.group] += bytes; lcg_bsr[lch[lcid].cfg.group] += bytes;
logger.debug("SCHED: UL buffer update=%d, lcg_id=%d, bsr=%s", bytes, lch[lcid].cfg.group, get_bsr_text().c_str()); if (logger.debug.enabled()) {
fmt::memory_buffer str_buffer;
fmt::format_to(str_buffer, "{}", get_bsr_state());
logger.debug(
"SCHED: UL buffer update=%d, lcg_id=%d, bsr=%s", bytes, lch[lcid].cfg.group, srslte::to_c_str(str_buffer));
}
} }
void lch_ue_manager::dl_buffer_state(uint8_t lcid, uint32_t tx_queue, uint32_t retx_queue) void lch_ue_manager::dl_buffer_state(uint8_t lcid, uint32_t tx_queue, uint32_t retx_queue)
@ -321,11 +331,9 @@ int lch_ue_manager::get_bsr_with_overhead(uint32_t lcg) const
return get_ul_mac_sdu_size_with_overhead(get_bsr(lcg)); return get_ul_mac_sdu_size_with_overhead(get_bsr(lcg));
} }
std::string lch_ue_manager::get_bsr_text() const const std::array<int, 4>& lch_ue_manager::get_bsr_state() const
{ {
std::stringstream ss; return lcg_bsr;
ss << "{" << lcg_bsr[0] << ", " << lcg_bsr[1] << ", " << lcg_bsr[2] << ", " << lcg_bsr[3] << "}";
return ss.str();
} }
uint32_t allocate_mac_sdus(sched_interface::dl_sched_data_t* data, uint32_t allocate_mac_sdus(sched_interface::dl_sched_data_t* data,

Loading…
Cancel
Save