Compute Performance

This commit is contained in:
Xavier Arteaga 2021-05-17 09:59:29 +02:00 committed by Xavier Arteaga
parent 1603580901
commit ac9dc6f31d
3 changed files with 28 additions and 0 deletions

View File

@ -86,6 +86,18 @@ public:
*/
uint32_t get_earfcn() const override { return current_arfcn; };
/**
* @brief Computes the average measurement performance since last configuration
* @return The performance in Millions of samples per second
*/
uint32_t get_perf() const
{
if (perf_count_us == 0) {
return 0;
}
return (uint32_t)(perf_count_samples / perf_count_us);
};
private:
/**
* @brief Provides with the RAT to the base class
@ -107,6 +119,10 @@ private:
float thr_snr_db = 5.0f;
int serving_cell_pci = -1;
/// Performance
uint64_t perf_count_us = 0; ///< Counts execution time in microseconds
uint64_t perf_count_samples = 0; ///< Counts the number samples
/// NR-based measuring objects
srsran_ssb_t ssb = {}; ///< SS/PBCH Block
};

View File

@ -60,6 +60,10 @@ bool intra_measure_nr::set_config(uint32_t arfcn, const config_t& cfg)
current_arfcn = arfcn;
serving_cell_pci = cfg.serving_cell_pci;
// Reset performance measurement
perf_count_samples = 0;
perf_count_us = 0;
// Configure generic side
intra_measure_base::args_t base_cfg = {};
base_cfg.srate_hz = cfg.srate_hz;
@ -84,6 +88,8 @@ bool intra_measure_nr::set_config(uint32_t arfcn, const config_t& cfg)
void intra_measure_nr::measure_rat(const measure_context_t& context, std::vector<cf_t>& buffer)
{
std::chrono::steady_clock::time_point begin = std::chrono::steady_clock::now();
// Search and measure the best cell
srsran_csi_trs_measurements_t meas = {};
uint32_t N_id = 0;
@ -91,6 +97,10 @@ void intra_measure_nr::measure_rat(const measure_context_t& context, std::vector
Log(error, "Error searching for SSB");
}
std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now();
perf_count_us += std::chrono::duration_cast<std::chrono::microseconds>(end - begin).count();
perf_count_samples += context.sf_len * context.meas_len_ms;
// Early return if the found PCI matches with the serving cell ID
if (serving_cell_pci == (int)N_id) {
return;

View File

@ -489,6 +489,8 @@ int main(int argc, char** argv)
// Stop, it will block until the asynchronous thread quits
intra_measure.stop();
logger.warning("NR intra frequency performance %d Msps\n", intra_measure.get_perf());
ret = rrc.print_stats(args) ? SRSRAN_SUCCESS : SRSRAN_ERROR;
if (radio) {