You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
srsRAN_4G/srsue/hdr/metrics_stdout.h

71 lines
2.6 KiB
C

/**
* Copyright 2013-2021 Software Radio Systems Limited
*
* This file is part of srsRAN.
*
* srsRAN 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.
*
* srsRAN 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/.
*
*/
/******************************************************************************
* File: metrics_stdout.h
* Description: Metrics class printing to stdout.
*****************************************************************************/
#ifndef SRSUE_METRICS_STDOUT_H
#define SRSUE_METRICS_STDOUT_H
#include <pthread.h>
#include <stdint.h>
#include <string>
#include "srsran/common/metrics_hub.h"
#include "ue_metrics_interface.h"
namespace srsue {
class metrics_stdout : public srsran::metrics_listener<ue_metrics_t>
{
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%
4 years ago
metrics_stdout(){};
void toggle_print(bool b);
void set_metrics(const ue_metrics_t& m, const uint32_t period_usec);
void set_ue_handle(ue_metrics_interface* ue_);
void stop(){};
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);
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%
4 years ago
bool table_has_neighbours = false; ///< state of last table head
uint8_t n_reports = 10;
ue_metrics_interface* ue = nullptr;
};
} // namespace srsue
#endif // SRSUE_METRICS_STDOUT_H