From: Ondrej Lichtner <olichtne(a)redhat.com>
Adding a new parameter to the CPU evaluator - evaluation_filter. This
Parameter expects a dictionary where:
key - represents a hostid as accessed through Host.hostid property
value - list of strings representing cpu names
This dictionary will be used to pre-filter the results to evaluate. This
can be helpful when dealing with machines that have many cores and only
some are strictly used during the performance test. All the other cores
might be idling or the scheduler assigneds them tasks differently
between runs which can lead to confusing evaluations.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
.../Evaluators/BaselineCPUAverageEvaluator.py | 20 +++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/lnst/RecipeCommon/Perf/Evaluators/BaselineCPUAverageEvaluator.py
b/lnst/RecipeCommon/Perf/Evaluators/BaselineCPUAverageEvaluator.py
index d0bd5d2..5521c0b 100644
--- a/lnst/RecipeCommon/Perf/Evaluators/BaselineCPUAverageEvaluator.py
+++ b/lnst/RecipeCommon/Perf/Evaluators/BaselineCPUAverageEvaluator.py
@@ -10,16 +10,32 @@ from lnst.RecipeCommon.Perf.Results import result_averages_difference
class BaselineCPUAverageEvaluator(BaseEvaluator):
- def __init__(self, pass_difference):
+ def __init__(self, pass_difference, evaluation_filter=None):
self._pass_difference = pass_difference
+ self._evaluation_filter = evaluation_filter
def evaluate_results(self, recipe, results):
- for host_results in self._divide_results_by_host(results).values():
+ filtered_results = self._filter_results(results)
+
+ for host_results in self._divide_results_by_host(filtered_results).values():
self._evaluate_host_results(recipe, host_results)
def get_baseline(self, recipe, result):
return None
+ def _filter_results(self, results):
+ if self._evaluation_filter is None:
+ return results
+
+ filtered = []
+ for result in results:
+ if (
+ result.host.hostid in self._evaluation_filter
+ and result.cpu in self._evaluation_filter[result.host.hostid]
+ ):
+ filtered.append(result)
+ return filtered
+
def _divide_results_by_host(self, results):
results_by_host = {}
for result in results:
--
2.21.0