From 53116a99fc006e6104092654f14d69832096290c Mon Sep 17 00:00:00 2001 From: Francisco Paisana Date: Mon, 14 Dec 2020 14:46:03 +0000 Subject: [PATCH] add rlc metrics to rlc_um --- lib/include/srslte/upper/rlc_um_base.h | 7 +++++++ lib/include/srslte/upper/rlc_um_lte.h | 4 ---- lib/src/upper/rlc_um_base.cc | 17 +++++++++-------- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/lib/include/srslte/upper/rlc_um_base.h b/lib/include/srslte/upper/rlc_um_base.h index 5d35b00e7..fd5f64371 100644 --- a/lib/include/srslte/upper/rlc_um_base.h +++ b/lib/include/srslte/upper/rlc_um_base.h @@ -13,6 +13,7 @@ #ifndef SRSLTE_RLC_UM_BASE_H #define SRSLTE_RLC_UM_BASE_H +#include "srslte/adt/accumulators.h" #include "srslte/common/buffer_pool.h" #include "srslte/common/common.h" #include "srslte/common/log.h" @@ -84,6 +85,7 @@ protected: byte_buffer_pool* pool = nullptr; srslte::log_ref log; std::string rb_name; + rlc_um_base* parent = nullptr; rlc_config_t cfg = {}; @@ -94,6 +96,11 @@ protected: // Mutexes std::mutex mutex; + // Metrics +#ifdef ENABLE_TIMESTAMP + srslte::rolling_average mean_pdu_latency_us; +#endif + virtual int build_data_pdu(unique_byte_buffer_t pdu, uint8_t* payload, uint32_t nof_bytes) = 0; // helper functions diff --git a/lib/include/srslte/upper/rlc_um_lte.h b/lib/include/srslte/upper/rlc_um_lte.h index 205bda235..7016e163d 100644 --- a/lib/include/srslte/upper/rlc_um_lte.h +++ b/lib/include/srslte/upper/rlc_um_lte.h @@ -13,7 +13,6 @@ #ifndef SRSLTE_RLC_UM_LTE_H #define SRSLTE_RLC_UM_LTE_H -#include "srslte/adt/accumulators.h" #include "srslte/common/buffer_pool.h" #include "srslte/common/common.h" #include "srslte/common/log.h" @@ -65,9 +64,6 @@ private: uint32_t vt_us = 0; // Send state. SN to be assigned for next PDU. // Metrics -#ifdef ENABLE_TIMESTAMP - srslte::rolling_average mean_pdu_latency_us; -#endif void debug_state(); }; diff --git a/lib/src/upper/rlc_um_base.cc b/lib/src/upper/rlc_um_base.cc index 5f85fa5a3..02b14e38c 100644 --- a/lib/src/upper/rlc_um_base.cc +++ b/lib/src/upper/rlc_um_base.cc @@ -20,12 +20,7 @@ rlc_um_base::rlc_um_base(srslte::log_ref log_, srsue::pdcp_interface_rlc* pdcp_, srsue::rrc_interface_rlc* rrc_, srslte::timer_handler* timers_) : - log(log_), - lcid(lcid_), - pdcp(pdcp_), - rrc(rrc_), - timers(timers_), - pool(byte_buffer_pool::get_instance()) + log(log_), lcid(lcid_), pdcp(pdcp_), rrc(rrc_), timers(timers_), pool(byte_buffer_pool::get_instance()) {} rlc_um_base::~rlc_um_base() {} @@ -202,7 +197,9 @@ rlc_um_base::rlc_um_base_rx::~rlc_um_base_rx() {} * Tx subclass implementation (base) ***************************************************************************/ -rlc_um_base::rlc_um_base_tx::rlc_um_base_tx(rlc_um_base* parent_) : log(parent_->log), pool(parent_->pool) {} +rlc_um_base::rlc_um_base_tx::rlc_um_base_tx(rlc_um_base* parent_) : + log(parent_->log), pool(parent_->pool), parent(parent_) +{} rlc_um_base::rlc_um_base_tx::~rlc_um_base_tx() {} @@ -303,7 +300,11 @@ int rlc_um_base::rlc_um_base_tx::build_data_pdu(uint8_t* payload, uint32_t nof_b return 0; } } - return build_data_pdu(std::move(pdu), payload, nof_bytes); + int len = build_data_pdu(std::move(pdu), payload, nof_bytes); + if (len > 0) { + parent->metrics.sdu_tx_latency_us = mean_pdu_latency_us.value(); + } + return len; } } // namespace srslte