ms_srs: allow + operator when specifying CSV columns
this allows to sum dl_brate and ul_brate and perform the known operations, like max, average, etc. on both UL and DL bitrate combined For examples, with this CSV .. time;cc;pci;earfcn;rsrp;pl;cfo;dl_mcs;dl_snr;dl_turbo;dl_brate;dl_bler;ul_ta;ul_mcs;ul_buff;ul_brate;ul_bler;rf_o;rf_u;rf_l;is_attached 1999;0;1;3400;-67;59;913;27;29;0.50;10432.000000;0;2.6;20;0.0;10848.000000;0;0.0;0.0;0.0;1.0 2998;0;1;3400;-67;59;912;28;29;0.50;2136.000000;0;2.6;20;0.0;1680.000000;0;0.0;0.0;0.0;1.0 3997;0;1;3400;-69;61;909;28;29;0.50;2136.000000;0;2.6;20;0.0;1680.000000;0;0.0;0.0;0.0;1.0 .. one could calculate the average of DL and UL bit rate with: ue.verify_metric(1e6, operation='avg', metric='dl_brate+ul_brate', criterion='gt', window=test_duration) and veriy that it's average is greater than 1 Mbit/s Change-Id: I5c7c80bb107fa6b93b215176e6ebbb5dc8594860
This commit is contained in:
parent
2cfa4a3d3c
commit
1a96ecdeb6
|
@ -378,17 +378,26 @@ class srsUEMetrics(log.Origin):
|
|||
self.err("Error parsing metrics CSV file %s" % self.metrics_file)
|
||||
raise error
|
||||
|
||||
def verify(self, value, operation='avg', metric='dl_brate', criterion='gt', window=1):
|
||||
def verify(self, value, operation='avg', metric_str='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:
|
||||
raise log.Error('Unknown operation %s not in %r' % (operation, self.VALID_CRITERION))
|
||||
# check if given metric exists in data
|
||||
try:
|
||||
sel_data = self.raw_data[metric]
|
||||
except ValueError as err:
|
||||
print('metric %s not available' % metric)
|
||||
raise err
|
||||
sel_data = numpy.array([])
|
||||
metrics_list = metric_str.split('+') # allow addition operator for columns
|
||||
for metric in metrics_list:
|
||||
try:
|
||||
vec = numpy.array(self.raw_data[metric])
|
||||
except ValueError as err:
|
||||
print('metric %s not available' % metric)
|
||||
raise err
|
||||
if sel_data.size == 0:
|
||||
# Initialize with dimension of first metric vector
|
||||
sel_data = vec
|
||||
else:
|
||||
# Sum them up assuming same array dimension
|
||||
sel_data += vec
|
||||
|
||||
if operation == 'avg':
|
||||
result = numpy.average(sel_data)
|
||||
|
@ -407,7 +416,7 @@ class srsUEMetrics(log.Origin):
|
|||
success = True
|
||||
|
||||
# Convert bitrate in Mbit/s:
|
||||
if metric.find('brate') > 0:
|
||||
if metric_str.find('brate') > 0:
|
||||
result /= 1e6
|
||||
value /= 1e6
|
||||
mbit_str = ' Mbit/s'
|
||||
|
|
Loading…
Reference in New Issue