proc_bsr: refactor and add extra print_state() method

allows to call the print_state() routine from other places in the BSR
This commit is contained in:
Andre Puschmann 2020-10-26 10:21:54 +01:00
parent d1ef5bd915
commit d5286e70aa
2 changed files with 15 additions and 9 deletions

View File

@ -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();

View File

@ -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;