This patch adds test_type param to all PerfRepo template functions. When this param is not specified, it is expected the test to be *_STREAM and metric labels are throughput, throughput_deviation, etc. When the param is set to RR, metric labels used are rr_rate, rr_rate_deviation, etc.
This is needed for the new short-lived connections test, where the unit we measure is not throughput but request/response rate.
Signed-off-by: Jiri Prochazka jprochaz@redhat.com --- lnst/Controller/PerfRepoUtils.py | 52 ++++++++++++++++++++++++++++------------ 1 file changed, 37 insertions(+), 15 deletions(-)
diff --git a/lnst/Controller/PerfRepoUtils.py b/lnst/Controller/PerfRepoUtils.py index 4c545e4..8d5a29d 100644 --- a/lnst/Controller/PerfRepoUtils.py +++ b/lnst/Controller/PerfRepoUtils.py @@ -14,7 +14,7 @@ olichtne@redhat.com (Ondrej Lichtner) import logging from lnst.Common.Utils import Noop
-def netperf_baseline_template(module, baseline): +def netperf_baseline_template(module, baseline, test_type="STREAM"): module.unset_option('threshold') module.unset_option('threshold_deviation')
@@ -22,35 +22,51 @@ def netperf_baseline_template(module, baseline): return module
try: - throughput = baseline.get_value('throughput') - deviation = baseline.get_value('throughput_deviation') + if test_type == "RR": + throughput = baseline.get_value('rr_rate') + deviation = baseline.get_value('rr_rate_deviation') + else: + throughput = baseline.get_value('throughput') + deviation = baseline.get_value('throughput_deviation') except: logging.error("Invalid baseline TestExecution passed.") return module
logging.debug("Setting Netperf threshold.") if throughput is not None and deviation is not None: - module.update_options({'threshold': '%s bits/sec' % throughput, - 'threshold_deviation': '%s bits/sec' % deviation}) + if test_type == "RR": + module.update_options({'threshold': '%s Trans/sec' % throughput, + 'threshold_deviation': '%s Trans/sec' % deviation}) + else: + module.update_options({'threshold': '%s bits/sec' % throughput, + 'threshold_deviation': '%s bits/sec' % deviation}) return module
-def perfrepo_baseline_to_dict(baseline): +def perfrepo_baseline_to_dict(baseline, test_type="STREAM"): if baseline.get_texec() is None: return {}
try: - throughput = baseline.get_value('throughput') - deviation = baseline.get_value('throughput_deviation') + if test_type == "RR": + throughput = baseline.get_value('rr_rate') + deviation = baseline.get_value('rr_rate_deviation') + else: + throughput = baseline.get_value('throughput') + deviation = baseline.get_value('throughput_deviation') except: logging.error("Invalid baseline TestExecution passed.") return {}
if throughput is not None and deviation is not None: - return {'threshold': '%s bits/sec' % throughput, - 'threshold_deviation': '%s bits/sec' % deviation} + if test_type == "RR": + return {'threshold': '%s Trans/sec' % throughput, + 'threshold_deviation': '%s Trans/sec' % deviation} + else: + return {'threshold': '%s bits/sec' % throughput, + 'threshold_deviation': '%s bits/sec' % deviation} return {}
-def netperf_result_template(perfrepo_result, netperf_result): +def netperf_result_template(perfrepo_result, netperf_result, test_type="STREAM"): if isinstance(perfrepo_result, Noop): return perfrepo_result
@@ -64,9 +80,15 @@ def netperf_result_template(perfrepo_result, netperf_result): return perfrepo_result
logging.debug("Adding Netperf results to PerfRepo object.") - perfrepo_result.add_value('throughput', rate) - perfrepo_result.add_value('throughput_min', rate - deviation) - perfrepo_result.add_value('throughput_max', rate + deviation) - perfrepo_result.add_value('throughput_deviation', deviation) + if test_type == "RR": + perfrepo_result.add_value('rr_rate', rate) + perfrepo_result.add_value('rr_rate_min', rate - deviation) + perfrepo_result.add_value('rr_rate_max', rate + deviation) + perfrepo_result.add_value('rr_rate_deviation', deviation) + else: + perfrepo_result.add_value('throughput', rate) + perfrepo_result.add_value('throughput_min', rate - deviation) + perfrepo_result.add_value('throughput_max', rate + deviation) + perfrepo_result.add_value('throughput_deviation', deviation)
return perfrepo_result
lnst-developers@lists.fedorahosted.org