add stats for multiple tests + fix stat files concatenation
This commit is contained in:
+2
-2
@@ -493,9 +493,9 @@ class RANManagement():
|
|||||||
conf_file='../ci-scripts/stats_monitor_conf.yaml'
|
conf_file='../ci-scripts/stats_monitor_conf.yaml'
|
||||||
if self.eNB_Stats=='yes':
|
if self.eNB_Stats=='yes':
|
||||||
if (self.air_interface[self.eNB_instance] == 'lte-softmodem') or (self.air_interface[self.eNB_instance] == 'ocp-enb'):
|
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:
|
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 matplotlib.pyplot as plt
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import yaml
|
import yaml
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
class StatMonitor():
|
class StatMonitor():
|
||||||
@@ -66,11 +67,15 @@ class StatMonitor():
|
|||||||
files = ["nrL1_stats.log", "nrMAC_stats.log", "nrPDCP_stats.log", "nrRRC_stats.log"]
|
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
|
# append each file's contents to another file (prepended with CI-) for
|
||||||
# post-mortem/debugging analysis
|
# post-mortem/debugging analysis
|
||||||
for f in files:
|
#for f in files:
|
||||||
cmd = rf'cat {f} >> CI-{f}'
|
# cmd = 'cat '+ f + ' >> CI-' + f
|
||||||
subprocess.Popen(shlex.split(cmd))
|
# if os.path.isfile(f):
|
||||||
|
# subprocess.Popen(cmd,shell=True)
|
||||||
# join the files for further processing
|
# 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)
|
process=subprocess.Popen(shlex.split(cmd), stdout=subprocess.PIPE)
|
||||||
output = process.stdout.readlines()
|
output = process.stdout.readlines()
|
||||||
if node_type=='enb':
|
if node_type=='enb':
|
||||||
@@ -79,7 +84,7 @@ class StatMonitor():
|
|||||||
self.process_gnb(node_type,output)
|
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
|
for page in self.d[node_type]['graph']:#work out a set a graphs per page
|
||||||
col = 1
|
col = 1
|
||||||
figure, axis = plt.subplots(len(self.d[node_type]['graph'][page]), col ,figsize=(10, 10))
|
figure, axis = plt.subplots(len(self.d[node_type]['graph'][page]), col ,figsize=(10, 10))
|
||||||
@@ -110,13 +115,14 @@ class StatMonitor():
|
|||||||
|
|
||||||
plt.tight_layout()
|
plt.tight_layout()
|
||||||
#save as png
|
#save as png
|
||||||
plt.savefig(node_type+'_stats_monitor_'+page+'.png')
|
plt.savefig(node_type+'_stats_monitor_'+testcase_id+'_'+page+'.png')
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
cfg_filename = sys.argv[1] #yaml file as metrics config
|
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)
|
mon=StatMonitor(cfg_filename)
|
||||||
|
|
||||||
#collecting stats when modem process is stopped
|
#collecting stats when modem process is stopped
|
||||||
@@ -131,4 +137,4 @@ if __name__ == "__main__":
|
|||||||
print('Process stopped')
|
print('Process stopped')
|
||||||
with open(node+'_stats_monitor.pickle', 'wb') as handle:
|
with open(node+'_stats_monitor.pickle', 'wb') as handle:
|
||||||
pickle.dump(mon.d, handle, protocol=pickle.HIGHEST_PROTOCOL)
|
pickle.dump(mon.d, handle, protocol=pickle.HIGHEST_PROTOCOL)
|
||||||
mon.graph(node)
|
mon.graph(testcase_id, node)
|
||||||
|
|||||||
Reference in New Issue
Block a user