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/.

pespin gerrit-no-reply at lists.osmocom.org
Tue May 26 13:55:39 UTC 2020


pespin has submitted this change. ( 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(-)

Approvals:
  pespin: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/osmo_gsm_tester/obj/ms_srs.py b/src/osmo_gsm_tester/obj/ms_srs.py
index 3fa282e..a147ce6 100644
--- a/src/osmo_gsm_tester/obj/ms_srs.py
+++ b/src/osmo_gsm_tester/obj/ms_srs.py
@@ -337,7 +337,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()
@@ -351,13 +351,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' : '>=' }
@@ -378,7 +378,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:
@@ -394,6 +394,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: 5
Gerrit-Owner: srs_andre <andre at softwareradiosystems.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200526/3e2c76f7/attachment.htm>


More information about the gerrit-log mailing list