From 8e4f2a4d593d765a722cc983d201e63e615e9b0f Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Wed, 26 Feb 2020 10:50:40 +0100 Subject: [PATCH] add UE parameter to enable TTI stats calculations --- srsue/hdr/stack/ue_stack_base.h | 1 + srsue/src/main.cc | 6 +++++- srsue/src/stack/ue_stack_lte.cc | 16 +++++++++------- srsue/ue.conf.example | 3 +++ 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/srsue/hdr/stack/ue_stack_base.h b/srsue/hdr/stack/ue_stack_base.h index cfd17c127..2a23961ab 100644 --- a/srsue/hdr/stack/ue_stack_base.h +++ b/srsue/hdr/stack/ue_stack_base.h @@ -66,6 +66,7 @@ typedef struct { std::string ue_category_str; nas_args_t nas; gw_args_t gw; + bool have_tti_time_stats; } stack_args_t; class ue_stack_base diff --git a/srsue/src/main.cc b/srsue/src/main.cc index 3d7b9c21f..4fdee34ae 100644 --- a/srsue/src/main.cc +++ b/srsue/src/main.cc @@ -366,7 +366,11 @@ static int parse_args(all_args_t* args, int argc, char* argv[]) ("general.metrics_csv_filename", bpo::value(&args->general.metrics_csv_filename)->default_value("/tmp/ue_metrics.csv"), - "Metrics CSV filename"); + "Metrics CSV filename") + + ("stack.have_tti_time_stats", + bpo::value(&args->stack.have_tti_time_stats)->default_value(true), + "Calculate TTI execution statistics"); // Positional options - config file location bpo::options_description position("Positional options"); diff --git a/srsue/src/stack/ue_stack_lte.cc b/srsue/src/stack/ue_stack_lte.cc index 175051089..59eb762dc 100644 --- a/srsue/src/stack/ue_stack_lte.cc +++ b/srsue/src/stack/ue_stack_lte.cc @@ -295,8 +295,15 @@ void ue_stack_lte::run_tti_impl(uint32_t tti) nas.run_tti(tti); timers.step_all(); - auto end = std::chrono::steady_clock::now(); - calc_tti_stats(std::chrono::duration_cast(end - start).count()); + if (args.have_tti_time_stats) { + auto end = std::chrono::steady_clock::now(); + calc_tti_stats(std::chrono::duration_cast(end - start).count()); + } + + // print warning if PHY pushes new TTI messages faster than we process them + if (pending_tasks.size(sync_queue_id) > SYNC_QUEUE_WARN_THRESHOLD) { + log.warning("Detected slow task processing (sync_queue_len=%zd).\n", pending_tasks.size(sync_queue_id)); + } } void ue_stack_lte::calc_tti_stats(const uint32_t duration_us) @@ -319,11 +326,6 @@ void ue_stack_lte::calc_tti_stats(const uint32_t duration_us) proc_time.clear(); } - - // print warning if PHY pushes new TTI messages faster than we process them - if (pending_tasks.size(sync_queue_id) > SYNC_QUEUE_WARN_THRESHOLD) { - log.warning("Detected slow task processing (sync_queue_len=%zd).\n", pending_tasks.size(sync_queue_id)); - } } /******************** diff --git a/srsue/ue.conf.example b/srsue/ue.conf.example index 4ccc91b6b..1ef676c06 100644 --- a/srsue/ue.conf.example +++ b/srsue/ue.conf.example @@ -348,8 +348,11 @@ enable = false # # metrics_csv_filename: File path to use for CSV metrics. # +# have_tti_time_stats: Calculate TTI execution statistics using system clock +# ##################################################################### [general] #metrics_csv_enable = false #metrics_period_secs = 1 #metrics_csv_filename = /tmp/ue_metrics.csv +#have_tti_time_stats = true \ No newline at end of file