Change in osmo-gsm-tester[master]: ms_srs: add max rolling average as metric operation

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

srs_andre gerrit-no-reply at lists.osmocom.org
Mon May 25 20:39:45 UTC 2020


srs_andre has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-gsm-tester/+/18472 )


Change subject: ms_srs: add max rolling average as metric operation
......................................................................

ms_srs: add max rolling average as metric operation

this allows to calculate the rolling average over a specific
window in time and take the maximum of that

this is useful to get average value for 30s UDP traffic for
example from the UE metrics

Change-Id: I34bbfe08dbc1f27b86c9805f54649d44d697fa18
---
M src/osmo_gsm_tester/obj/ms_srs.py
1 file changed, 8 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/72/18472/1

diff --git a/src/osmo_gsm_tester/obj/ms_srs.py b/src/osmo_gsm_tester/obj/ms_srs.py
index fc60044..571a964 100644
--- a/src/osmo_gsm_tester/obj/ms_srs.py
+++ b/src/osmo_gsm_tester/obj/ms_srs.py
@@ -332,7 +332,7 @@
             return self._get_counter_handover_success()
         raise log.Error('counter %s not implemented!' % counter_name)
 
-    def verify_metric(self, value, operation='avg', metric='dl_brate', criterion='gt'):
+    def verify_metric(self, value, operation='avg', metric='dl_brate', criterion='gt', window=1):
         # file is not properly flushed until the process has stopped.
         if self.running():
             self.stop()
@@ -346,13 +346,13 @@
                     self.err('Failed copying back metrics file from remote host')
                     raise e
         metrics = srsUEMetrics(self.metrics_file)
-        return metrics.verify(value, operation, metric, criterion)
+        return metrics.verify(value, operation, metric, criterion, window)
 
 numpy = None
 
 class srsUEMetrics(log.Origin):
 
-    VALID_OPERATIONS = ['avg', 'sum']
+    VALID_OPERATIONS = ['avg', 'sum', 'max_rolling_avg']
     VALID_CRITERION = ['eq','gt','lt']
     CRITERION_TO_SYM = { 'eq' : '==', 'gt' : '>', 'lt' : '<' }
     CRYTERION_TO_SYM_OPPOSITE = { 'eq' : '!=', 'gt' : '<=', 'lt' : '>=' }
@@ -373,7 +373,7 @@
             self.err("Error parsing metrics CSV file %s" % self.metrics_file)
             raise error
 
-    def verify(self, value, operation='avg', metric='dl_brate', criterion='gt'):
+    def verify(self, value, operation='avg', metric='dl_brate', criterion='gt', window=1):
         if operation not in self.VALID_OPERATIONS:
             raise log.Error('Unknown operation %s not in %r' % (operation, self.VALID_OPERATIONS))
         if criterion not in self.VALID_CRITERION:
@@ -389,6 +389,10 @@
             result = numpy.average(sel_data)
         elif operation == 'sum':
             result = numpy.sum(sel_data)
+        elif operation == 'max_rolling_avg':
+            # calculate rolling average over window and take maximum value
+            result = numpy.amax(numpy.convolve(sel_data, numpy.ones((window,))/window, mode='valid'))
+
         self.dbg(result=result, value=value)
 
         success = False

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-gsm-tester/+/18472
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Change-Id: I34bbfe08dbc1f27b86c9805f54649d44d697fa18
Gerrit-Change-Number: 18472
Gerrit-PatchSet: 1
Gerrit-Owner: srs_andre <andre at softwareradiosystems.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200525/59ee6149/attachment.htm>


More information about the gerrit-log mailing list