add RRC metrics and remove extra methods to query RRC state

This commit is contained in:
Andre Puschmann 2019-07-12 04:08:24 +02:00
parent 5e49aca835
commit b46a71c2d8
10 changed files with 49 additions and 31 deletions

View File

@ -25,6 +25,7 @@
#include "pthread.h"
#include "rrc_common.h"
#include "rrc_metrics.h"
#include "srslte/asn1/rrc_asn1_utils.h"
#include "srslte/common/bcd_helpers.h"
#include "srslte/common/block_queue.h"
@ -300,7 +301,7 @@ public:
void stop();
rrc_state_t get_state();
void get_metrics(rrc_metrics_t& m);
// Timeout callback interface
void timer_expired(uint32_t timeout_id);

View File

@ -0,0 +1,35 @@
/*
* Copyright 2013-2019 Software Radio Systems Limited
*
* This file is part of srsLTE.
*
* srsLTE is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* srsLTE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* A copy of the GNU Affero General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
*/
#ifndef SRSUE_RRC_METRICS_H
#define SRSUE_RRC_METRICS_H
#include "rrc_common.h"
namespace srsue {
struct rrc_metrics_t {
rrc_state_t state;
};
} // namespace srsue
#endif // SRSUE_RRC_METRICS_H

View File

@ -79,7 +79,6 @@ public:
virtual void stop() = 0;
virtual bool switch_on() = 0;
virtual bool switch_off() = 0;
virtual bool is_rrc_connected() = 0;
// UE metrics interface
virtual bool get_metrics(stack_metrics_t* metrics) = 0;

View File

@ -98,7 +98,6 @@ public:
void stop();
bool switch_on();
bool switch_off();
bool is_rrc_connected();
void start_plot();
// UE metrics interface

View File

@ -29,6 +29,7 @@
#include "srslte/radio/radio_metrics.h"
#include "srslte/upper/rlc_metrics.h"
#include "stack/mac/mac_metrics.h"
#include "stack/rrc/rrc_metrics.h"
#include "stack/upper/gw_metrics.h"
#include "stack/upper/nas_metrics.h"
@ -38,6 +39,7 @@ typedef struct {
mac_metrics_t mac[SRSLTE_MAX_CARRIERS];
srslte::rlc_metrics_t rlc;
nas_metrics_t nas;
rrc_metrics_t rrc;
} stack_metrics_t;
typedef struct {
@ -52,7 +54,6 @@ class ue_metrics_interface : public srslte::metrics_interface<ue_metrics_t>
{
public:
virtual bool get_metrics(ue_metrics_t* m) = 0;
virtual bool is_rrc_connected() = 0;
};
} // namespace srsue

View File

@ -131,7 +131,7 @@ void metrics_csv::set_metrics(ue_metrics_t &metrics, const uint32_t period_usec)
file << float_to_string(metrics.rf.rf_o, 2);
file << float_to_string(metrics.rf.rf_u, 2);
file << float_to_string(metrics.rf.rf_l, 2);
file << (ue->is_rrc_connected() ? "1.0" : "0.0");
file << (metrics.stack.rrc.state == RRC_STATE_CONNECTED ? "1.0" : "0.0");
file << "\n";
n_reports++;

View File

@ -63,7 +63,7 @@ void metrics_stdout::set_metrics(ue_metrics_t &metrics, const uint32_t period_us
if(!do_print || ue == NULL)
return;
if (!ue->is_rrc_connected()) {
if (metrics.stack.rrc.state != RRC_STATE_CONNECTED) {
cout << "--- disconnected ---" << endl;
return;
}

View File

@ -192,18 +192,15 @@ void rrc::stop() {
wait_thread_finish();
}
rrc_state_t rrc::get_state() {
return state;
void rrc::get_metrics(rrc_metrics_t& m)
{
m.state = state;
}
bool rrc::is_connected() {
return (RRC_STATE_CONNECTED == state);
}
bool rrc::have_drb() {
return drb_up;
}
/*
* Low priority thread to run functions that can not be executed from main thread
*/

View File

@ -186,20 +186,11 @@ bool ue_stack_lte::switch_off()
bool ue_stack_lte::get_metrics(stack_metrics_t* metrics)
{
if (EMM_STATE_REGISTERED == nas.get_state()) {
if (RRC_STATE_CONNECTED == rrc.get_state()) {
mac.get_metrics(metrics->mac);
rlc.get_metrics(metrics->rlc);
nas.get_metrics(&metrics->nas);
return true;
}
}
return false;
}
bool ue_stack_lte::is_rrc_connected()
{
return rrc.is_connected();
mac.get_metrics(metrics->mac);
rlc.get_metrics(metrics->rlc);
nas.get_metrics(&metrics->nas);
rrc.get_metrics(metrics->rrc);
return (metrics->nas.state == EMM_STATE_REGISTERED && metrics->rrc.state == RRC_STATE_CONNECTED);
}
void ue_stack_lte::run_thread()

View File

@ -244,11 +244,6 @@ bool ue::switch_off()
return stack->switch_off();
}
bool ue::is_rrc_connected()
{
return stack->is_rrc_connected();
}
void ue::start_plot()
{
phy->start_plot();