mirror of https://github.com/pvnis/srsRAN_4G.git
e2ap: adding e2 metrics interface files
parent
7d8a21cb77
commit
4bf162cbf1
@ -0,0 +1,31 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* \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.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "srsran/common/common.h"
|
||||||
|
#include "srsran/common/interfaces_common.h"
|
||||||
|
#include "srsran/interfaces/enb_metrics_interface.h"
|
||||||
|
#include "srsran/srsran.h"
|
||||||
|
|
||||||
|
#ifndef SRSRAN_E2_INTERFACES_H
|
||||||
|
#define SRSRAN_E2_INTERFACES_H
|
||||||
|
|
||||||
|
namespace srsenb {
|
||||||
|
|
||||||
|
class e2_interface_metrics
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual bool pull_metrics(enb_metrics_t* m) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace srsenb
|
||||||
|
|
||||||
|
#endif // SRSRAN_ENB_INTERFACES_H
|
@ -0,0 +1,48 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* \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.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* File: metrics_stdout.h
|
||||||
|
* Description: Metrics class printing to stdout.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef SRSENB_METRICS_E2_H
|
||||||
|
#define SRSENB_METRICS_E2_H
|
||||||
|
|
||||||
|
#include "srsran/interfaces/e2_metrics_interface.h"
|
||||||
|
#include "srsran/interfaces/enb_metrics_interface.h"
|
||||||
|
#include <pthread.h>
|
||||||
|
#include <queue>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#define METRICS_BUFFER_SIZE 20
|
||||||
|
namespace srsenb {
|
||||||
|
|
||||||
|
class metrics_e2 : public srsran::metrics_listener<enb_metrics_t>, public e2_interface_metrics
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
metrics_e2(enb_metrics_interface* enb_) : do_print(false) {}
|
||||||
|
void set_metrics(const enb_metrics_t& m, const uint32_t period_usec);
|
||||||
|
bool pull_metrics(enb_metrics_t* m) override;
|
||||||
|
void stop(){};
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::atomic<bool> do_print = {false};
|
||||||
|
uint8_t n_reports = 0;
|
||||||
|
std::queue<enb_metrics_t> metrics_queue;
|
||||||
|
enb_metrics_interface* enb = nullptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace srsenb
|
||||||
|
|
||||||
|
#endif // SRSENB_METRICS_STDOUT_H
|
@ -0,0 +1,38 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* \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.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "srsenb/hdr/metrics_e2.h"
|
||||||
|
#include "srsran/phy/utils/vector.h"
|
||||||
|
|
||||||
|
using namespace srsenb;
|
||||||
|
|
||||||
|
void metrics_e2::set_metrics(const enb_metrics_t& m, const uint32_t period_usec)
|
||||||
|
{
|
||||||
|
if (metrics_queue.size() > METRICS_BUFFER_SIZE) {
|
||||||
|
metrics_queue.pop();
|
||||||
|
metrics_queue.push(m);
|
||||||
|
} else {
|
||||||
|
metrics_queue.push(m);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool metrics_e2::pull_metrics(enb_metrics_t* m)
|
||||||
|
{
|
||||||
|
if (enb != nullptr) {
|
||||||
|
if (!metrics_queue.empty()) {
|
||||||
|
*m = metrics_queue.front();
|
||||||
|
metrics_queue.pop();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
Loading…
Reference in New Issue