srsLTE/srsue/hdr/metrics_stdout.h

63 lines
2.1 KiB
C
Raw Normal View History

/**
2017-05-30 06:38:04 -07:00
*
* \section COPYRIGHT
2017-05-30 06:38:04 -07:00
*
2021-03-19 03:45:56 -07:00
* Copyright 2013-2021 Software Radio Systems Limited
2017-05-30 06:38:04 -07:00
*
* 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.
2017-05-30 06:38:04 -07:00
*
*/
/******************************************************************************
* File: metrics_stdout.h
* Description: Metrics class printing to stdout.
*****************************************************************************/
2018-03-31 10:04:04 -07:00
#ifndef SRSUE_METRICS_STDOUT_H
#define SRSUE_METRICS_STDOUT_H
2017-05-30 06:38:04 -07:00
#include <pthread.h>
#include <stdint.h>
#include <string>
2021-03-19 03:45:56 -07:00
#include "srsran/common/metrics_hub.h"
2017-05-30 06:38:04 -07:00
#include "ue_metrics_interface.h"
namespace srsue {
2021-03-19 03:45:56 -07:00
class metrics_stdout : public srsran::metrics_listener<ue_metrics_t>
2017-05-30 06:38:04 -07:00
{
public:
metrics_stdout: print new table header if neighbour cells change this fixes an issue where the stdout metrics isn't readable if the only neighbour cell gets removed during the 10s where no table header is printed. --------Signal--------------Neighbor----DL-------------------------------------UL---------------------- cc pci rsrp pl cfo pci rsrp mcs snr turbo brate bler ta_us mcs buff brate bler 0 2 -66 61 -3.3k 1 -76 11 18 1.1 8.4M 3% 0.0 21 262 167k 0% 0 2 -65 60 -3.3k 1 -76 12 19 1.1 9.6M 2% 0.0 22 476 214k 0% 0 2 -65 60 -3.3k 1 -76 16 22 1.3 13M 3% 0.0 23 1.1k 734k 0% 0 2 -64 59 -3.3k 1 -76 17 23 1.3 15M 2% 0.0 23 602 424k 0% 0 2 -63 58 -3.3k 1 -77 20 25 1.4 19M 3% 0.0 23 501 304k 0% 0 2 -62 57 -3.3k 1 -77 22 27 1.8 20M 10% 0.0 22 417 418k 0% 0 2 -61 56 -3.3k 1 -77 24 28 1.8 25M 9% 0.0 23 396 439k 0% 0 2 -61 56 -3.3k 1 -77 26 29 1.5 23M 22% 0.0 23 841 407k 0% 0 2 -60 55 -3.3k 1 -77 27 31 1.3 27M 11% 0.0 23 890 1.1M 0% 0 2 -59 54 -3.3k 1 -77 27 32 1.00 30M 3% 0.0 23 583 524k 0% 0 2 -59 54 -3.3k 1 -77 27 32 0.92 32M 1% 0.0 23 1.1k 503k 0% --------Signal--------------DL-------------------------------------UL---------------------- cc pci rsrp pl cfo mcs snr turbo brate bler ta_us mcs buff brate bler 0 2 -59 54 -3.3k 27 31 1.1 30M 4% 0.0 23 1.2k 529k 0% 0 2 -60 55 -3.3k 27 30 1.4 25M 18% 0.0 23 540 442k 0% 0 2 -61 56 -3.3k 26 29 1.6 23M 21% 0.0 23 536 429k 0% 0 2 -62 57 -3.3k 24 28 1.8 23M 13% 0.0 23 834 456k 0% 0 2 -62 57 -3.3k 1 -78 21 26 1.6 20M 7% 0.0 23 723 425k 0% 0 2 -63 58 -3.3k 1 -76 17 22 1.1 15M 3% 0.0 23 470 267k 0% 0 2 -64 59 -3.3k 1 -77 17 22 1.3 15M 3% 0.0 23 167 280k 0% 0 2 -65 60 -3.3k 1 -76 14 21 1.3 11M 2% 0.0 22 57 223k 0% 0 2 -65 60 -3.3k 1 -76 12 19 1.2 9.0M 3% 0.0 21 135 182k 0% 0 2 -66 61 -3.4k 1 -70 9.3 17 1.0 6.9M 2% 0.0 21 246 126k 0% 0 2 -67 62 -3.3k 1 -75 8.2 16 1.1 4.9M 3% 0.0 20 0.0 122k 0%
2020-09-30 07:29:31 -07:00
metrics_stdout(){};
2017-05-30 06:38:04 -07:00
void toggle_print(bool b);
2020-01-13 04:14:46 -08:00
void set_metrics(const ue_metrics_t& m, const uint32_t period_usec);
void set_ue_handle(ue_metrics_interface* ue_);
void stop(){};
2017-05-30 06:38:04 -07:00
private:
static const bool FORCE_NEIGHBOUR_CELL = false; // Set to true for printing always neighbour cells
void set_metrics_helper(const phy_metrics_t& phy,
const mac_metrics_t mac[SRSRAN_MAX_CARRIERS],
const rrc_metrics_t& rrc,
bool display_neighbours,
const uint32_t r,
bool is_carrier_nr,
bool print_carrier_num);
std::string float_to_string(float f, int digits);
std::string float_to_eng_string(float f, int digits);
void print_table(const bool display_neighbours, const bool is_nr);
2017-05-30 06:38:04 -07:00
std::atomic<bool> do_print = {false};
metrics_stdout: print new table header if neighbour cells change this fixes an issue where the stdout metrics isn't readable if the only neighbour cell gets removed during the 10s where no table header is printed. --------Signal--------------Neighbor----DL-------------------------------------UL---------------------- cc pci rsrp pl cfo pci rsrp mcs snr turbo brate bler ta_us mcs buff brate bler 0 2 -66 61 -3.3k 1 -76 11 18 1.1 8.4M 3% 0.0 21 262 167k 0% 0 2 -65 60 -3.3k 1 -76 12 19 1.1 9.6M 2% 0.0 22 476 214k 0% 0 2 -65 60 -3.3k 1 -76 16 22 1.3 13M 3% 0.0 23 1.1k 734k 0% 0 2 -64 59 -3.3k 1 -76 17 23 1.3 15M 2% 0.0 23 602 424k 0% 0 2 -63 58 -3.3k 1 -77 20 25 1.4 19M 3% 0.0 23 501 304k 0% 0 2 -62 57 -3.3k 1 -77 22 27 1.8 20M 10% 0.0 22 417 418k 0% 0 2 -61 56 -3.3k 1 -77 24 28 1.8 25M 9% 0.0 23 396 439k 0% 0 2 -61 56 -3.3k 1 -77 26 29 1.5 23M 22% 0.0 23 841 407k 0% 0 2 -60 55 -3.3k 1 -77 27 31 1.3 27M 11% 0.0 23 890 1.1M 0% 0 2 -59 54 -3.3k 1 -77 27 32 1.00 30M 3% 0.0 23 583 524k 0% 0 2 -59 54 -3.3k 1 -77 27 32 0.92 32M 1% 0.0 23 1.1k 503k 0% --------Signal--------------DL-------------------------------------UL---------------------- cc pci rsrp pl cfo mcs snr turbo brate bler ta_us mcs buff brate bler 0 2 -59 54 -3.3k 27 31 1.1 30M 4% 0.0 23 1.2k 529k 0% 0 2 -60 55 -3.3k 27 30 1.4 25M 18% 0.0 23 540 442k 0% 0 2 -61 56 -3.3k 26 29 1.6 23M 21% 0.0 23 536 429k 0% 0 2 -62 57 -3.3k 24 28 1.8 23M 13% 0.0 23 834 456k 0% 0 2 -62 57 -3.3k 1 -78 21 26 1.6 20M 7% 0.0 23 723 425k 0% 0 2 -63 58 -3.3k 1 -76 17 22 1.1 15M 3% 0.0 23 470 267k 0% 0 2 -64 59 -3.3k 1 -77 17 22 1.3 15M 3% 0.0 23 167 280k 0% 0 2 -65 60 -3.3k 1 -76 14 21 1.3 11M 2% 0.0 22 57 223k 0% 0 2 -65 60 -3.3k 1 -76 12 19 1.2 9.0M 3% 0.0 21 135 182k 0% 0 2 -66 61 -3.4k 1 -70 9.3 17 1.0 6.9M 2% 0.0 21 246 126k 0% 0 2 -67 62 -3.3k 1 -75 8.2 16 1.1 4.9M 3% 0.0 20 0.0 122k 0%
2020-09-30 07:29:31 -07:00
bool table_has_neighbours = false; ///< state of last table head
uint8_t n_reports = 10;
ue_metrics_interface* ue = nullptr;
std::mutex mutex;
2017-05-30 06:38:04 -07:00
};
} // namespace srsue
2018-03-31 10:04:04 -07:00
#endif // SRSUE_METRICS_STDOUT_H