From d5286e70aa3ef722d081061dc079c755ca3cd1e9 Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Mon, 26 Oct 2020 10:21:54 +0100 Subject: [PATCH] proc_bsr: refactor and add extra print_state() method allows to call the print_state() routine from other places in the BSR --- srsue/hdr/stack/mac/proc_bsr.h | 1 + srsue/src/stack/mac/proc_bsr.cc | 23 ++++++++++++++--------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/srsue/hdr/stack/mac/proc_bsr.h b/srsue/hdr/stack/mac/proc_bsr.h index aaaa64da2..f64c65ea8 100644 --- a/srsue/hdr/stack/mac/proc_bsr.h +++ b/srsue/hdr/stack/mac/proc_bsr.h @@ -96,6 +96,7 @@ private: typedef enum { NONE, REGULAR, PADDING, PERIODIC } triggered_bsr_type_t; triggered_bsr_type_t triggered_bsr_type = NONE; + void print_state(); void set_trigger(triggered_bsr_type_t new_trigger); void update_new_data(); void update_buffer_state(); diff --git a/srsue/src/stack/mac/proc_bsr.cc b/srsue/src/stack/mac/proc_bsr.cc index 52471dafd..ad55ebaa5 100644 --- a/srsue/src/stack/mac/proc_bsr.cc +++ b/srsue/src/stack/mac/proc_bsr.cc @@ -45,15 +45,7 @@ void bsr_proc::init(sr_proc* sr_, // Print periodically the LCID queue status auto queue_status_print_task = [this](uint32_t tid) { - 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=%s, LCID QUEUE status: %s\n", bsr_type_tostring(triggered_bsr_type), str); + print_state(); timer_queue_status_print.run(); }; timer_queue_status_print.set(QUEUE_STATUS_PERIOD_MS, queue_status_print_task); @@ -62,6 +54,19 @@ void bsr_proc::init(sr_proc* sr_, initiated = true; } +void bsr_proc::print_state() +{ + 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=%s, LCID QUEUE status: %s\n", bsr_type_tostring(triggered_bsr_type), str); +} + void bsr_proc::set_trigger(srsue::bsr_proc::triggered_bsr_type_t new_trigger) { triggered_bsr_type = new_trigger;