Commit b48bae76 authored by hardy's avatar hardy

add stats for multiple tests + fix stat files concatenation

parent a3d9d50e
......@@ -493,9 +493,9 @@ class RANManagement():
conf_file='../ci-scripts/stats_monitor_conf.yaml'
if self.eNB_Stats=='yes':
if (self.air_interface[self.eNB_instance] == 'lte-softmodem') or (self.air_interface[self.eNB_instance] == 'ocp-enb'):
mySSH.command('echo $USER; nohup python3 ' + monitor_file + ' ' + conf_file + ' enb 2>&1 > enb_stats_monitor_execution.log &', '\$', 5)
mySSH.command('echo $USER; nohup python3 ' + monitor_file + ' ' + conf_file + ' ' + self.testCase_id + ' enb 2>&1 > enb_stats_monitor_execution.log &', '\$', 5)
else:
mySSH.command('echo $USER; nohup python3 ' + monitor_file + ' ' + conf_file + ' gnb 2>&1 > gnb_stats_monitor_execution.log &', '\$', 5)
mySSH.command('echo $USER; nohup python3 ' + monitor_file + ' ' + conf_file + ' ' + self.testCase_id + ' gnb 2>&1 > gnb_stats_monitor_execution.log &', '\$', 5)
......
......@@ -11,6 +11,7 @@ import pickle
import matplotlib.pyplot as plt
import numpy as np
import yaml
import os
class StatMonitor():
......@@ -66,11 +67,15 @@ class StatMonitor():
files = ["nrL1_stats.log", "nrMAC_stats.log", "nrPDCP_stats.log", "nrRRC_stats.log"]
# append each file's contents to another file (prepended with CI-) for
# post-mortem/debugging analysis
for f in files:
cmd = rf'cat {f} >> CI-{f}'
subprocess.Popen(shlex.split(cmd))
#for f in files:
# cmd = 'cat '+ f + ' >> CI-' + f
# if os.path.isfile(f):
# subprocess.Popen(cmd,shell=True)
# join the files for further processing
cmd = rf'cat {shlex.join(files)}'
cmd='cat '
for f in files:
if os.path.isfile(f):
cmd += f+' '
process=subprocess.Popen(shlex.split(cmd), stdout=subprocess.PIPE)
output = process.stdout.readlines()
if node_type=='enb':
......@@ -79,7 +84,7 @@ class StatMonitor():
self.process_gnb(node_type,output)
def graph(self,node_type):
def graph(self,testcase_id, node_type):
for page in self.d[node_type]['graph']:#work out a set a graphs per page
col = 1
figure, axis = plt.subplots(len(self.d[node_type]['graph'][page]), col ,figsize=(10, 10))
......@@ -110,13 +115,14 @@ class StatMonitor():
plt.tight_layout()
#save as png
plt.savefig(node_type+'_stats_monitor_'+page+'.png')
plt.savefig(node_type+'_stats_monitor_'+testcase_id+'_'+page+'.png')
if __name__ == "__main__":
cfg_filename = sys.argv[1] #yaml file as metrics config
node = sys.argv[2]#enb or gnb
testcase_id = sys.argv[2] #test case id to name files accordingly, especially if we have several tests in a sequence
node = sys.argv[3]#enb or gnb
mon=StatMonitor(cfg_filename)
#collecting stats when modem process is stopped
......@@ -131,4 +137,4 @@ if __name__ == "__main__":
print('Process stopped')
with open(node+'_stats_monitor.pickle', 'wb') as handle:
pickle.dump(mon.d, handle, protocol=pickle.HIGHEST_PROTOCOL)
mon.graph(node)
mon.graph(testcase_id, node)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment