From eb5210dbdad346f9e4a08e6dedd3ce6e5f4c1771 Mon Sep 17 00:00:00 2001 From: Xavier Arteaga Date: Fri, 18 Sep 2020 18:42:57 +0200 Subject: [PATCH] Radio stops Rx stream prior to stop and benchmark prompts RF metrics --- lib/src/radio/radio.cc | 6 ++++++ lib/src/radio/test/benchmark_radio.cc | 9 ++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/src/radio/radio.cc b/lib/src/radio/radio.cc index 3bf8f55bd..de99922dd 100644 --- a/lib/src/radio/radio.cc +++ b/lib/src/radio/radio.cc @@ -241,6 +241,12 @@ bool radio::is_init() void radio::stop() { + // Stop Rx streams as soon as possible to avoid Overflows + if (radio_is_streaming) { + for (srslte_rf_t& rf_device : rf_devices) { + srslte_rf_stop_rx_stream(&rf_device); + } + } if (zeros) { free(zeros); zeros = NULL; diff --git a/lib/src/radio/test/benchmark_radio.cc b/lib/src/radio/test/benchmark_radio.cc index fd6c82779..a905fc4a2 100644 --- a/lib/src/radio/test/benchmark_radio.cc +++ b/lib/src/radio/test/benchmark_radio.cc @@ -281,6 +281,7 @@ int main(int argc, char** argv) srslte_dft_plan_t dft_plan = {}, idft_plan = {}; srslte_agc_t agc[SRSLTE_MAX_RADIOS] = {}; phy_dummy phy; + srslte::rf_metrics_t rf_metrics = {}; rf_buffer_t rf_buffers[SRSLTE_MAX_RADIOS] = {}; @@ -523,7 +524,13 @@ int main(int argc, char** argv) nof_samples -= frame_size; } - printf("Finished streaming with %d gaps...\n", nof_gaps); + radio_h[0]->get_metrics(&rf_metrics); + + printf("Finished streaming with %d gaps, %d late timestamps, %d overflows, %d underflow...\n", + nof_gaps, + rf_metrics.rf_l, + rf_metrics.rf_o, + rf_metrics.rf_u); ret = SRSLTE_SUCCESS;