mirror of https://github.com/PentHertz/srsLTE.git
ue,rrc: add RRC metrics and fix stdout
This commit is contained in:
parent
d71f4152cd
commit
4890ee9875
|
@ -15,6 +15,7 @@
|
|||
|
||||
#include "../rrc/rrc_cell.h"
|
||||
#include "rrc_nr_config.h"
|
||||
#include "rrc_nr_metrics.h"
|
||||
#include "srsran/adt/circular_map.h"
|
||||
#include "srsran/asn1/rrc_nr.h"
|
||||
#include "srsran/asn1/rrc_nr_utils.h"
|
||||
|
@ -35,8 +36,6 @@ class usim_interface_rrc_nr;
|
|||
class pdcp_interface_rrc;
|
||||
class rlc_interface_rrc;
|
||||
|
||||
struct rrc_nr_metrics_t {};
|
||||
|
||||
class rrc_nr final : public rrc_interface_phy_nr,
|
||||
public rrc_interface_pdcp,
|
||||
public rrc_interface_rlc,
|
||||
|
@ -185,14 +184,6 @@ private:
|
|||
uint32_t sim_measurement_carrier_freq_r15;
|
||||
srsran::timer_handler::unique_timer sim_measurement_timer;
|
||||
|
||||
/// RRC states (3GPP 38.331 v15.5.1 Sec 4.2.1)
|
||||
enum rrc_nr_state_t {
|
||||
RRC_NR_STATE_IDLE = 0,
|
||||
RRC_NR_STATE_CONNECTED,
|
||||
RRC_NR_STATE_CONNECTED_INACTIVE,
|
||||
RRC_NR_STATE_N_ITEMS,
|
||||
};
|
||||
const static char* rrc_nr_state_text[RRC_NR_STATE_N_ITEMS];
|
||||
rrc_nr_state_t state = RRC_NR_STATE_IDLE;
|
||||
|
||||
uint8_t transaction_id = 0;
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
/**
|
||||
*
|
||||
* \section COPYRIGHT
|
||||
*
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set
|
||||
* forth in the LICENSE file which can be found at the top level of
|
||||
* the distribution.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SRSUE_RRC_NR_METRICS_H
|
||||
#define SRSUE_RRC_NR_METRICS_H
|
||||
|
||||
namespace srsue {
|
||||
|
||||
/// RRC states (3GPP 38.331 v15.5.1 Sec 4.2.1)
|
||||
enum rrc_nr_state_t {
|
||||
RRC_NR_STATE_IDLE = 0,
|
||||
RRC_NR_STATE_CONNECTED,
|
||||
RRC_NR_STATE_CONNECTED_INACTIVE,
|
||||
RRC_NR_STATE_N_ITEMS,
|
||||
};
|
||||
|
||||
struct rrc_nr_metrics_t {
|
||||
rrc_nr_state_t state;
|
||||
};
|
||||
|
||||
} // namespace srsue
|
||||
|
||||
#endif // SRSUE_RRC_NR_METRICS_H
|
|
@ -22,6 +22,7 @@
|
|||
#include "srsran/system/sys_metrics.h"
|
||||
#include "stack/mac/mac_metrics.h"
|
||||
#include "stack/rrc/rrc_metrics.h"
|
||||
#include "stack/rrc_nr/rrc_nr_metrics.h"
|
||||
#include "stack/upper/gw_metrics.h"
|
||||
#include "stack/upper/nas_metrics.h"
|
||||
|
||||
|
@ -34,7 +35,7 @@ typedef struct {
|
|||
srsran::rlc_metrics_t rlc;
|
||||
nas_metrics_t nas;
|
||||
rrc_metrics_t rrc;
|
||||
rrc_metrics_t rrc_nr;
|
||||
rrc_nr_metrics_t rrc_nr;
|
||||
} stack_metrics_t;
|
||||
|
||||
typedef struct {
|
||||
|
|
|
@ -181,7 +181,7 @@ void metrics_stdout::set_metrics(const ue_metrics_t& metrics, const uint32_t per
|
|||
return;
|
||||
}
|
||||
|
||||
if (metrics.stack.rrc.state != RRC_STATE_CONNECTED) {
|
||||
if (metrics.stack.rrc.state != RRC_STATE_CONNECTED && metrics.stack.rrc_nr.state != RRC_NR_STATE_CONNECTED) {
|
||||
fmt::print("--- disconnected ---\n");
|
||||
return;
|
||||
}
|
||||
|
@ -193,25 +193,30 @@ void metrics_stdout::set_metrics(const ue_metrics_t& metrics, const uint32_t per
|
|||
display_neighbours |= metrics.stack.rrc.neighbour_cells.size() > 0;
|
||||
}
|
||||
|
||||
bool is_nr = metrics.phy_nr.nof_active_cc > 0;
|
||||
bool has_lte = metrics.phy.nof_active_cc > 0;
|
||||
bool has_nr = metrics.phy_nr.nof_active_cc > 0;
|
||||
|
||||
// print table header every 10 reports
|
||||
if (++n_reports > 10) {
|
||||
print_table(display_neighbours, is_nr);
|
||||
print_table(display_neighbours, has_nr);
|
||||
}
|
||||
|
||||
// also print table header if neighbours are added/removed in between
|
||||
if (display_neighbours != table_has_neighbours) {
|
||||
print_table(display_neighbours, is_nr);
|
||||
print_table(display_neighbours, has_nr);
|
||||
}
|
||||
|
||||
for (uint32_t r = 0; r < metrics.phy.nof_active_cc; r++) {
|
||||
set_metrics_helper(metrics.phy, metrics.stack.mac, metrics.stack.rrc, display_neighbours, r, false, !is_nr);
|
||||
if (has_lte) {
|
||||
for (uint32_t r = 0; r < metrics.phy.nof_active_cc; r++) {
|
||||
set_metrics_helper(metrics.phy, metrics.stack.mac, metrics.stack.rrc, display_neighbours, r, false, !has_nr);
|
||||
}
|
||||
}
|
||||
|
||||
for (uint32_t r = 0; r < metrics.phy_nr.nof_active_cc; r++) {
|
||||
// Assumption LTE is followed by the NR carriers.
|
||||
set_metrics_helper(metrics.phy_nr, metrics.stack.mac_nr, metrics.stack.rrc, display_neighbours, r, true, !is_nr);
|
||||
if (has_nr) {
|
||||
for (uint32_t r = 0; r < metrics.phy_nr.nof_active_cc; r++) {
|
||||
// Assumption LTE is followed by the NR carriers.
|
||||
set_metrics_helper(metrics.phy_nr, metrics.stack.mac_nr, metrics.stack.rrc, display_neighbours, r, true, !has_nr);
|
||||
}
|
||||
}
|
||||
|
||||
if (metrics.rf.rf_error) {
|
||||
|
|
|
@ -25,7 +25,7 @@ using namespace asn1;
|
|||
using namespace srsran;
|
||||
namespace srsue {
|
||||
|
||||
const char* rrc_nr::rrc_nr_state_text[] = {"IDLE", "CONNECTED", "CONNECTED-INACTIVE"};
|
||||
const static char* rrc_nr_state_text[] = {"IDLE", "CONNECTED", "CONNECTED-INACTIVE"};
|
||||
|
||||
rrc_nr::rrc_nr(srsran::task_sched_handle task_sched_) :
|
||||
logger(srslog::fetch_basic_logger("RRC-NR")),
|
||||
|
@ -101,7 +101,11 @@ void rrc_nr::init_core_less()
|
|||
pdcp->add_bearer(args.coreless.drb_lcid, pdcp_cnfg);
|
||||
return;
|
||||
}
|
||||
void rrc_nr::get_metrics(rrc_nr_metrics_t& m) {}
|
||||
|
||||
void rrc_nr::get_metrics(rrc_nr_metrics_t& m)
|
||||
{
|
||||
m.state = state;
|
||||
}
|
||||
|
||||
const char* rrc_nr::get_rb_name(uint32_t lcid)
|
||||
{
|
||||
|
|
|
@ -350,6 +350,7 @@ bool ue_stack_lte::get_metrics(stack_metrics_t* metrics)
|
|||
rlc.get_metrics(metrics.rlc, metrics.mac[0].nof_tti);
|
||||
nas.get_metrics(&metrics.nas);
|
||||
rrc.get_metrics(metrics.rrc);
|
||||
rrc_nr.get_metrics(metrics.rrc_nr);
|
||||
pending_stack_metrics.push(metrics);
|
||||
});
|
||||
// wait for result
|
||||
|
|
Loading…
Reference in New Issue