From 5f325b402960ce7130aed5c1e0afd362d060ee60 Mon Sep 17 00:00:00 2001 From: faluco Date: Thu, 18 Feb 2021 18:51:23 +0100 Subject: [PATCH] - Calculate the metric time stamp for JSON at the end of the function. - Add a range check when traversing the metric structs. --- srsenb/src/metrics_json.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/srsenb/src/metrics_json.cc b/srsenb/src/metrics_json.cc index caeff385c..10ed726fd 100644 --- a/srsenb/src/metrics_json.cc +++ b/srsenb/src/metrics_json.cc @@ -158,6 +158,9 @@ static bool has_valid_metric_ranges(const enb_metrics_t& m, unsigned index) if (index >= m.stack.rlc.ues.size()) { return false; } + if (index >= m.stack.pdcp.ues.size()) { + return false; + } return true; } @@ -175,7 +178,6 @@ void metrics_json::set_metrics(const enb_metrics_t& m, const uint32_t period_use // Fill root object. ctx.write("metrics"); - ctx.write(get_time_stamp()); auto& sector_list = ctx.get(); sector_list.resize(m.stack.mac.cc_rach_counter.size()); @@ -201,5 +203,6 @@ void metrics_json::set_metrics(const enb_metrics_t& m, const uint32_t period_use } // Log the context. + ctx.write(get_time_stamp()); log_c(ctx); }