summaryrefslogtreecommitdiffstats
path: root/scripts/automation/regression/stateless_tests/stl_benchmark_test.py
diff options
context:
space:
mode:
authorHanoh Haim <hhaim@cisco.com>2017-01-12 13:47:39 +0200
committerHanoh Haim <hhaim@cisco.com>2017-01-15 17:10:16 +0200
commit420216e583706fbd7bf214818fcce0143a05e982 (patch)
tree0fd39bac06af7e12889406b0f20cd40527e0d18f /scripts/automation/regression/stateless_tests/stl_benchmark_test.py
parent4e5a651c8e052cdbcad73f6af5ce065ffd6dbce4 (diff)
add elk
Signed-off-by: Hanoh Haim <hhaim@cisco.com>
Diffstat (limited to 'scripts/automation/regression/stateless_tests/stl_benchmark_test.py')
-rwxr-xr-xscripts/automation/regression/stateless_tests/stl_benchmark_test.py82
1 files changed, 60 insertions, 22 deletions
diff --git a/scripts/automation/regression/stateless_tests/stl_benchmark_test.py b/scripts/automation/regression/stateless_tests/stl_benchmark_test.py
index 6940efd3..fbc58765 100755
--- a/scripts/automation/regression/stateless_tests/stl_benchmark_test.py
+++ b/scripts/automation/regression/stateless_tests/stl_benchmark_test.py
@@ -4,6 +4,7 @@ from trex_stl_lib.api import *
import os, sys
from collections import deque
from time import time, sleep
+import pprint
class STLBenchmark_Test(CStlGeneral_Test):
"""Benchark stateless performance"""
@@ -14,9 +15,21 @@ class STLBenchmark_Test(CStlGeneral_Test):
stabilize = 5 # ensure stabilization over this period
print('')
- for profile_bench in self.get_benchmark_param('profiles'):
+ #self.get_benchmark_param('profiles')
+ #profiles=[{'bw_per_core': 1,
+ # 'cpu_util': 1,
+ # 'kwargs': {'packet_len': 64},
+ # 'name': 'stl/udp_for_benchmarks.py'}]
+
+ profiles = self.get_benchmark_param('profiles')
+ dp_cores = self.stl_trex.system_info.get('dp_core_count', 0)
+
+ for profile_bench in profiles:
+
cpu_utils = deque([0] * stabilize, maxlen = stabilize)
- bws_per_core = deque([0] * stabilize, maxlen = stabilize)
+ bps = deque([0] * stabilize, maxlen = stabilize)
+ pps = deque([0] * stabilize, maxlen = stabilize)
+
kwargs = profile_bench.get('kwargs', {})
print('Testing profile %s, kwargs: %s' % (profile_bench['name'], kwargs))
profile = STLProfile.load(os.path.join(CTRexScenario.scripts_path, profile_bench['name']), **kwargs)
@@ -32,13 +45,30 @@ class STLBenchmark_Test(CStlGeneral_Test):
for i in range(timeout + 1):
stats = self.stl_trex.get_stats()
cpu_utils.append(stats['global']['cpu_util'])
- bws_per_core.append(stats['global']['bw_per_core'])
+ bps.append(stats['global']['tx_bps'])
+ pps.append(stats['global']['tx_pps'])
+
if i > stabilize and min(cpu_utils) > max(cpu_utils) * 0.95:
break
sleep(0.5)
agv_cpu_util = sum(cpu_utils) / stabilize
- agv_bw_per_core = sum(bws_per_core) / stabilize
+ agv_pps = sum(pps) / stabilize
+ agv_bps = sum(bps) / stabilize
+
+ if agv_cpu_util == 0.0:
+ agv_cpu_util=1.0;
+
+ agv_mpps = (agv_pps/1e6);
+ agv_gbps = (agv_bps/1e9)
+
+
+ agv_gbps_norm = agv_gbps * 100.0/agv_cpu_util;
+ agv_mpps_norm = agv_mpps * 100.0/agv_cpu_util;
+
+ agv_gbps_norm_pc = agv_gbps_norm/dp_cores;
+ agv_mpps_norm_pc = agv_mpps_norm/dp_cores;
+
if critical_test and i == timeout and agv_cpu_util > 10:
raise Exception('Timeout on waiting for stabilization, last CPU util values: %s' % list(cpu_utils))
@@ -48,24 +78,32 @@ class STLBenchmark_Test(CStlGeneral_Test):
raise Exception('Too much queue_full: %s' % stats['global']['queue_full'])
if not cpu_utils[-1]:
raise Exception('CPU util is zero, last values: %s' % list(cpu_utils))
- print('Done (%ss), CPU util: %4g, bw_per_core: %6sGb/core' % (int(time() - start_time), agv_cpu_util, round(agv_bw_per_core, 2)))
- # TODO: add check of benchmark based on results from regression
-
- # report benchmarks
- if self.GAManager:
- try:
- pass
- #profile_repr = '%s.%s %s' % (CTRexScenario.setup_name,
- # os.path.basename(profile_bench['name']),
- # repr(kwargs).replace("'", ''))
- #self.GAManager.gaAddAction(Event = 'stateless_test', action = profile_repr,
- # label = 'bw_per_core', value = int(agv_bw_per_core))
- # TODO: report expected once acquired
- #self.GAManager.gaAddAction(Event = 'stateless_test', action = profile_repr,
- # label = 'bw_per_core_exp', value = int(expected_norm_cpu))
- #self.GAManager.emptyAndReportQ()
- except Exception as e:
- print('Sending GA failed: %s' % e)
+ print('Done (%ss), CPU util: %4g, norm_pps_per_core:%6smpps norm_bw_per_core: %6sGb/core' % (int(time() - start_time), agv_cpu_util, round(agv_mpps_norm_pc,2), round(agv_gbps_norm_pc, 2)))
+
+ # report benchmarks to elk
+ if self.elk:
+ streams=kwargs.get('stream_count',1)
+ elk_obj = self.get_elk_obj()
+ print("\n* Reporting to elk *\n")
+ name=profile_bench['name']
+ elk_obj['test']={ "name" : name,
+ "type" : "stateless-range",
+ "cores" : dp_cores,
+ "cpu%" : agv_cpu_util,
+ "mpps" : (agv_mpps),
+ "streams_count" :streams,
+ "mpps_pc" : (agv_mpps_norm_pc),
+ "gbps_pc" : (agv_gbps_norm_pc),
+ "gbps" : (agv_gbps),
+ "avg-pktsize" : round((1000.0*agv_gbps/(8.0*agv_mpps))),
+ "latecny" : { "min" : -1.0,
+ "max" : -1.0,
+ "avr" : -1.0
+ }
+ };
+ #pprint.pprint(elk_obj);
+ self.elk.perf.push_data(elk_obj)
+
def tearDown(self):
self.stl_trex.reset()