From: Ondrej Lichtner <olichtne(a)redhat.com>
Small refactoring of the generate_perf_configurations method:
* each measurement object should be instantiated anew for each
PerfRecipeConf object that is being yielded - moved the
cpu_measurement creation into the main loop of the method
* created a new perf_recipe_conf dictionary that collects the main
EnrtConfiguration instance, EnrtSubConfiguration instance and the list
of measured flows. This describes the "purpose" of the current
perf configuration (PerfRecipeConf object) and logically connects all
the measurement results into a single group of results.
This is required in order to properly save the measurement results
into the database and then be able to differentiate between them
later.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
lnst/Recipes/ENRT/BaseEnrtRecipe.py | 34 +++++++++++++++++++++--------
1 file changed, 25 insertions(+), 9 deletions(-)
diff --git a/lnst/Recipes/ENRT/BaseEnrtRecipe.py b/lnst/Recipes/ENRT/BaseEnrtRecipe.py
index 6beee3c..7686251 100644
--- a/lnst/Recipes/ENRT/BaseEnrtRecipe.py
+++ b/lnst/Recipes/ENRT/BaseEnrtRecipe.py
@@ -229,22 +229,38 @@ class BaseEnrtRecipe(PingTestAndEvaluate, PerfRecipe):
client_netns = client_nic.netns
server_netns = server_nic.netns
- cpu_measurement = self.params.cpu_perf_tool(
- [client_netns, server_netns])
-
- flow_combinations = self.generate_flow_combinations(main_config, sub_config)
+ flow_combinations = self.generate_flow_combinations(
+ main_config, sub_config
+ )
for flows in flow_combinations:
- flows_measurement = self.params.net_perf_tool(flows)
+ perf_recipe_conf=dict(
+ main_config=main_config,
+ sub_config=sub_config,
+ flows=flows,
+ )
+
+ flows_measurement = self.params.net_perf_tool(
+ flows,
+ perf_recipe_conf
+ )
+
+ cpu_measurement = self.params.cpu_perf_tool(
+ [client_netns, server_netns],
+ perf_recipe_conf,
+ )
perf_conf = PerfRecipeConf(
- measurements=[cpu_measurement, flows_measurement],
- iterations=self.params.perf_iterations)
+ measurements=[cpu_measurement, flows_measurement],
+ iterations=self.params.perf_iterations,
+ )
perf_conf.register_evaluators(
- cpu_measurement, self.cpu_perf_evaluators)
+ cpu_measurement, self.cpu_perf_evaluators
+ )
perf_conf.register_evaluators(
- flows_measurement, self.net_perf_evaluators)
+ flows_measurement, self.net_perf_evaluators
+ )
yield perf_conf
--
2.21.0