diff --git a/srsue/hdr/stack/mac/mux.h b/srsue/hdr/stack/mac/mux.h index 190d2b4f0..a0277c8ee 100644 --- a/srsue/hdr/stack/mac/mux.h +++ b/srsue/hdr/stack/mac/mux.h @@ -58,7 +58,7 @@ public: void reset(); void init(rlc_interface_mac* rlc, bsr_interface_mux* bsr_procedure, phr_proc* phr_procedure_); - void step(const uint32_t tti); + void step(); bool is_pending_any_sdu(); bool is_pending_sdu(uint32_t lcid); diff --git a/srsue/hdr/stack/mac/proc_bsr.h b/srsue/hdr/stack/mac/proc_bsr.h index 76f09e760..8fc686c88 100644 --- a/srsue/hdr/stack/mac/proc_bsr.h +++ b/srsue/hdr/stack/mac/proc_bsr.h @@ -97,7 +97,6 @@ private: triggered_bsr_type_t triggered_bsr_type; bool sr_is_sent; - uint32_t last_print; uint32_t current_tti; uint32_t trigger_tti; diff --git a/srsue/src/stack/mac/mac.cc b/srsue/src/stack/mac/mac.cc index 6a4c25ce8..932513dff 100644 --- a/srsue/src/stack/mac/mac.cc +++ b/srsue/src/stack/mac/mac.cc @@ -212,7 +212,7 @@ void mac::run_tti(const uint32_t tti) // Step all procedures Debug("Running MAC tti=%d\n", tti); - mux_unit.step(tti); + mux_unit.step(); bsr_procedure.step(tti); phr_procedure.step(tti); diff --git a/srsue/src/stack/mac/mux.cc b/srsue/src/stack/mac/mux.cc index ab2317bfd..7831b6e66 100644 --- a/srsue/src/stack/mac/mux.cc +++ b/srsue/src/stack/mac/mux.cc @@ -56,7 +56,7 @@ void mux::reset() pending_crnti_ce = 0; } -void mux::step(const uint32_t tti) +void mux::step() { std::lock_guard lock(mutex); diff --git a/srsue/src/stack/mac/proc_bsr.cc b/srsue/src/stack/mac/proc_bsr.cc index 47f4c9292..ef5677a2e 100644 --- a/srsue/src/stack/mac/proc_bsr.cc +++ b/srsue/src/stack/mac/proc_bsr.cc @@ -34,7 +34,6 @@ bsr_proc::bsr_proc() { log_h = NULL; initiated = false; - last_print = 0; current_tti = 0; trigger_tti = 0; triggered_bsr_type = NONE; @@ -52,6 +51,24 @@ void bsr_proc::init(rlc_interface_mac* rlc_, srslte::log* log_h_, srslte::timer_ timer_retx = timers_db->get_unique_timer(); reset(); + + // Print periodically the LCID queue status + auto queue_status_print_task = [this]() { + char str[128]; + str[0] = '\0'; + int n = 0; + for (auto& lcg : lcgs) { + for (auto& iter : lcg) { + n = srslte_print_check(str, 128, n, "%d: %d ", iter.first, iter.second.old_buffer); + } + } + Info("BSR: triggered_bsr_type=%d, LCID QUEUE status: %s\n", triggered_bsr_type, str); + }; + timers_db->defer_callback(QUEUE_STATUS_PERIOD_MS, [this, queue_status_print_task]() { + queue_status_print_task(); + timers_db->defer_callback(QUEUE_STATUS_PERIOD_MS, queue_status_print_task); + }); + initiated = true; } @@ -269,6 +286,7 @@ void bsr_proc::step(uint32_t tti) } pthread_mutex_lock(&mutex); + current_tti = tti; update_new_data(); @@ -280,18 +298,6 @@ void bsr_proc::step(uint32_t tti) update_buffer_state(); - if ((tti - last_print) % 10240 > QUEUE_STATUS_PERIOD_MS) { - char str[128]; - str[0] = '\0'; - int n = 0; - for (int i = 0; i < NOF_LCG; i++) { - for (std::map::iterator iter = lcgs[i].begin(); iter != lcgs[i].end(); ++iter) { - n = srslte_print_check(str, 128, n, "%d: %d ", iter->first, iter->second.old_buffer); - } - } - Info("BSR: triggered_bsr_type=%d, LCID QUEUE status: %s\n", triggered_bsr_type, str); - last_print = tti; - } pthread_mutex_unlock(&mutex); }