This patchset modifies the current implementation of the performance test tweaks.
Before the patch set the user was unable to add performance test tweaks on per iteration basis. It was only possible to add/remove tweaks before/after the whole set of the performance test measurement iterations.
The patchset adds BasePerfTestIterationTweakMixin to RecipeCommon.Perf.Recipe that provides a common API for that. The actual tasks to be performed before/after each iteration needs to be defined by a specific mixin class.
In the same manner the already existing BasePerfTestTweakMixin has been moved to RecipeCommon.Perf.Recipe to have both APIs at the same place.
Jan Tluka (6): RecipeCommon.Perf.PerfTestMixins: add BasePerfTestIterationTweakMixin RecipeCommon.Perf.Recipe: add per-iteration tweaks using BasePerfTestIterationTweakMixin lnst.Recipes.ENRT.PerfTestMixins: move BasePerfTestTweakMixin to RecipeCommon RecipeCommon.Perf.PerfTestMixins.BasePerfTestTweakMixin: move get_flow_measurements_from_config to standalone function lnst.Recipes.ENRT.PerfTestMixins: add DropCachesPerfTestMixin Recipes.ENRT.PerfTestMixins: extend CommonPerfTestTweakMixin with DropCachesMixin
.../BasePerfTestIterationTweakMixin.py | 18 ++++++++ .../PerfTestMixins/BasePerfTestTweakMixin.py | 6 --- lnst/RecipeCommon/Perf/Recipe.py | 41 ++++++++++++++----- lnst/Recipes/ENRT/BaseEnrtRecipe.py | 9 +--- .../CommonPerfTestTweakMixin.py | 3 +- .../PerfTestMixins/DropCachesPerfTestMixin.py | 36 ++++++++++++++++ .../SctpFirewallPerfTestMixin.py | 7 ++-- lnst/Recipes/ENRT/PerfTestMixins/Utils.py | 5 +++ lnst/Recipes/ENRT/PerfTestMixins/__init__.py | 2 +- 9 files changed, 99 insertions(+), 28 deletions(-) create mode 100644 lnst/RecipeCommon/Perf/PerfTestMixins/BasePerfTestIterationTweakMixin.py rename lnst/{Recipes/ENRT => RecipeCommon/Perf}/PerfTestMixins/BasePerfTestTweakMixin.py (63%) create mode 100644 lnst/Recipes/ENRT/PerfTestMixins/DropCachesPerfTestMixin.py create mode 100644 lnst/Recipes/ENRT/PerfTestMixins/Utils.py
This class defines a common API for any mixin classes that want to perform additional tasks before each iteration of a Perf.Recipe test.
Signed-off-by: Jan Tluka jtluka@redhat.com --- .../BasePerfTestIterationTweakMixin.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 lnst/RecipeCommon/Perf/PerfTestMixins/BasePerfTestIterationTweakMixin.py
diff --git a/lnst/RecipeCommon/Perf/PerfTestMixins/BasePerfTestIterationTweakMixin.py b/lnst/RecipeCommon/Perf/PerfTestMixins/BasePerfTestIterationTweakMixin.py new file mode 100644 index 00000000..6025f76e --- /dev/null +++ b/lnst/RecipeCommon/Perf/PerfTestMixins/BasePerfTestIterationTweakMixin.py @@ -0,0 +1,18 @@ +class BasePerfTestIterationTweakMixin(object): + """ + This class is an extension to the :any:`Perf.Recipe` and defines common API + for specific mixin classes that want to perform additional actions before + each of the *perf test iterations*. + + The mixin classes should implement each of the methods in collaborative manner. + """ + + def generate_perf_test_iteration_tweak_description(self, perf_config): + return ["Performance test iteration tweaks:"] + + def apply_perf_test_iteration_tweak(self, perf_config): + perf_config.perf_test_iteration_tweak_config = {} + + def remove_perf_test_iteration_tweak(self, perf_config): + # TODO: check if anything left in the perf_config.perf_test_iteration_tweak_config + pass
The Perf.Recipe class is now capable of running additional tasks before each of the measurement iterations.
Signed-off-by: Jan Tluka jtluka@redhat.com --- lnst/RecipeCommon/Perf/Recipe.py | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-)
diff --git a/lnst/RecipeCommon/Perf/Recipe.py b/lnst/RecipeCommon/Perf/Recipe.py index df69b1b6..d48b956c 100644 --- a/lnst/RecipeCommon/Perf/Recipe.py +++ b/lnst/RecipeCommon/Perf/Recipe.py @@ -6,6 +6,10 @@ from lnst.Controller.Recipe import BaseRecipe from lnst.RecipeCommon.Perf.Results import SequentialPerfResult from lnst.RecipeCommon.Perf.Results import ParallelPerfResult
+from lnst.RecipeCommon.Perf.PerfTestMixins import ( + BasePerfTestIterationTweakMixin, +) + class RecipeConf(object): def __init__(self, measurements, iterations): self._measurements = measurements @@ -49,22 +53,32 @@ class RecipeResults(object): aggregated_results, new_results) self._results[measurement] = aggregated_results
-class Recipe(BaseRecipe): +class Recipe(BasePerfTestIterationTweakMixin, BaseRecipe): def perf_test(self, recipe_conf): results = RecipeResults(recipe_conf)
for i in range(recipe_conf.iterations): - for measurement in recipe_conf.measurements: - measurement.start() - for measurement in reversed(recipe_conf.measurements): - measurement.finish() - for measurement in recipe_conf.measurements: - measurement_results = measurement.collect_results() - results.add_measurement_results( - measurement, measurement_results) + self.apply_perf_test_iteration_tweak(recipe_conf) + self.describe_perf_test_iteration_tweak(recipe_conf) + + try: + for measurement in recipe_conf.measurements: + measurement.start() + for measurement in reversed(recipe_conf.measurements): + measurement.finish() + for measurement in recipe_conf.measurements: + measurement_results = measurement.collect_results() + results.add_measurement_results( + measurement, measurement_results) + finally: + self.remove_perf_test_iteration_tweak(recipe_conf)
return results
+ def describe_perf_test_iteration_tweak(self, perf_config): + description = self.generate_perf_test_iteration_tweak_description(perf_config) + self.add_result(True, "\n".join(description)) + def perf_report_and_evaluate(self, results): self.perf_report(results)
It make more sense to have both BasePerfTestTweakMixin and BasePerfTestIterationTweakMixin in one place.
In addition, the BasePerfTestTweakMixin was moved from BaseEnrtRecipe to Perf.Recipe class.
Signed-off-by: Jan Tluka jtluka@redhat.com --- .../PerfTestMixins/BasePerfTestTweakMixin.py | 0 lnst/RecipeCommon/Perf/Recipe.py | 39 +++++++++++-------- lnst/Recipes/ENRT/BaseEnrtRecipe.py | 9 +---- .../SctpFirewallPerfTestMixin.py | 2 +- lnst/Recipes/ENRT/PerfTestMixins/__init__.py | 1 - 5 files changed, 26 insertions(+), 25 deletions(-) rename lnst/{Recipes/ENRT => RecipeCommon/Perf}/PerfTestMixins/BasePerfTestTweakMixin.py (100%)
diff --git a/lnst/Recipes/ENRT/PerfTestMixins/BasePerfTestTweakMixin.py b/lnst/RecipeCommon/Perf/PerfTestMixins/BasePerfTestTweakMixin.py similarity index 100% rename from lnst/Recipes/ENRT/PerfTestMixins/BasePerfTestTweakMixin.py rename to lnst/RecipeCommon/Perf/PerfTestMixins/BasePerfTestTweakMixin.py diff --git a/lnst/RecipeCommon/Perf/Recipe.py b/lnst/RecipeCommon/Perf/Recipe.py index d48b956c..63ffa7f8 100644 --- a/lnst/RecipeCommon/Perf/Recipe.py +++ b/lnst/RecipeCommon/Perf/Recipe.py @@ -7,6 +7,7 @@ from lnst.RecipeCommon.Perf.Results import SequentialPerfResult from lnst.RecipeCommon.Perf.Results import ParallelPerfResult
from lnst.RecipeCommon.Perf.PerfTestMixins import ( + BasePerfTestTweakMixin, BasePerfTestIterationTweakMixin, )
@@ -53,25 +54,31 @@ class RecipeResults(object): aggregated_results, new_results) self._results[measurement] = aggregated_results
-class Recipe(BasePerfTestIterationTweakMixin, BaseRecipe): +class Recipe(BasePerfTestTweakMixin, BasePerfTestIterationTweakMixin, BaseRecipe): def perf_test(self, recipe_conf): results = RecipeResults(recipe_conf)
- for i in range(recipe_conf.iterations): - self.apply_perf_test_iteration_tweak(recipe_conf) - self.describe_perf_test_iteration_tweak(recipe_conf) - - try: - for measurement in recipe_conf.measurements: - measurement.start() - for measurement in reversed(recipe_conf.measurements): - measurement.finish() - for measurement in recipe_conf.measurements: - measurement_results = measurement.collect_results() - results.add_measurement_results( - measurement, measurement_results) - finally: - self.remove_perf_test_iteration_tweak(recipe_conf) + self.apply_perf_test_tweak(recipe_conf) + self.describe_perf_test_tweak(recipe_conf) + + try: + for i in range(recipe_conf.iterations): + self.apply_perf_test_iteration_tweak(recipe_conf) + self.describe_perf_test_iteration_tweak(recipe_conf) + + try: + for measurement in recipe_conf.measurements: + measurement.start() + for measurement in reversed(recipe_conf.measurements): + measurement.finish() + for measurement in recipe_conf.measurements: + measurement_results = measurement.collect_results() + results.add_measurement_results( + measurement, measurement_results) + finally: + self.remove_perf_test_iteration_tweak(recipe_conf) + finally: + self.remove_perf_test_tweak(recipe_conf)
return results
diff --git a/lnst/Recipes/ENRT/BaseEnrtRecipe.py b/lnst/Recipes/ENRT/BaseEnrtRecipe.py index d629b726..180f922e 100644 --- a/lnst/Recipes/ENRT/BaseEnrtRecipe.py +++ b/lnst/Recipes/ENRT/BaseEnrtRecipe.py @@ -355,13 +355,8 @@ class BaseEnrtRecipe(CommonPerfTestTweakMixin, methods to execute, report and evaluate the results. """ for perf_config in self.generate_perf_configurations(recipe_config): - self.apply_perf_test_tweak(perf_config) - self.describe_perf_test_tweak(perf_config) - try: - result = self.perf_test(perf_config) - self.perf_report_and_evaluate(result) - finally: - self.remove_perf_test_tweak(perf_config) + result = self.perf_test(perf_config) + self.perf_report_and_evaluate(result)
def generate_ping_configurations(self, config): """Base ping test configuration generator diff --git a/lnst/Recipes/ENRT/PerfTestMixins/SctpFirewallPerfTestMixin.py b/lnst/Recipes/ENRT/PerfTestMixins/SctpFirewallPerfTestMixin.py index c0520405..841df3f7 100644 --- a/lnst/Recipes/ENRT/PerfTestMixins/SctpFirewallPerfTestMixin.py +++ b/lnst/Recipes/ENRT/PerfTestMixins/SctpFirewallPerfTestMixin.py @@ -1,5 +1,5 @@ from lnst.Controller.RecipeResults import ResultLevel -from lnst.Recipes.ENRT.PerfTestMixins import BasePerfTestTweakMixin +from lnst.RecipeCommon.Perf.PerfTestMixins import BasePerfTestTweakMixin
class SctpFirewallPerfTestMixin(BasePerfTestTweakMixin): def apply_perf_test_tweak(self, perf_config): diff --git a/lnst/Recipes/ENRT/PerfTestMixins/__init__.py b/lnst/Recipes/ENRT/PerfTestMixins/__init__.py index 8a109ad0..addfb641 100644 --- a/lnst/Recipes/ENRT/PerfTestMixins/__init__.py +++ b/lnst/Recipes/ENRT/PerfTestMixins/__init__.py @@ -1,3 +1,2 @@ -from lnst.Recipes.ENRT.PerfTestMixins.BasePerfTestTweakMixin import BasePerfTestTweakMixin from lnst.Recipes.ENRT.PerfTestMixins.SctpFirewallPerfTestMixin import SctpFirewallPerfTestMixin from lnst.Recipes.ENRT.PerfTestMixins.CommonPerfTestTweakMixin import CommonPerfTestTweakMixin
On Fri, Oct 30, 2020 at 09:30:44AM +0100, Jan Tluka wrote:
It make more sense to have both BasePerfTestTweakMixin and BasePerfTestIterationTweakMixin in one place.
In addition, the BasePerfTestTweakMixin was moved from BaseEnrtRecipe to Perf.Recipe class.
Signed-off-by: Jan Tluka jtluka@redhat.com
.../PerfTestMixins/BasePerfTestTweakMixin.py | 0 lnst/RecipeCommon/Perf/Recipe.py | 39 +++++++++++-------- lnst/Recipes/ENRT/BaseEnrtRecipe.py | 9 +---- .../SctpFirewallPerfTestMixin.py | 2 +- lnst/Recipes/ENRT/PerfTestMixins/__init__.py | 1 - 5 files changed, 26 insertions(+), 25 deletions(-) rename lnst/{Recipes/ENRT => RecipeCommon/Perf}/PerfTestMixins/BasePerfTestTweakMixin.py (100%)
diff --git a/lnst/Recipes/ENRT/PerfTestMixins/BasePerfTestTweakMixin.py b/lnst/RecipeCommon/Perf/PerfTestMixins/BasePerfTestTweakMixin.py similarity index 100% rename from lnst/Recipes/ENRT/PerfTestMixins/BasePerfTestTweakMixin.py rename to lnst/RecipeCommon/Perf/PerfTestMixins/BasePerfTestTweakMixin.py diff --git a/lnst/RecipeCommon/Perf/Recipe.py b/lnst/RecipeCommon/Perf/Recipe.py index d48b956c..63ffa7f8 100644 --- a/lnst/RecipeCommon/Perf/Recipe.py +++ b/lnst/RecipeCommon/Perf/Recipe.py @@ -7,6 +7,7 @@ from lnst.RecipeCommon.Perf.Results import SequentialPerfResult from lnst.RecipeCommon.Perf.Results import ParallelPerfResult
from lnst.RecipeCommon.Perf.PerfTestMixins import (
BasePerfTestTweakMixin, BasePerfTestIterationTweakMixin,
)
@@ -53,25 +54,31 @@ class RecipeResults(object): aggregated_results, new_results) self._results[measurement] = aggregated_results
-class Recipe(BasePerfTestIterationTweakMixin, BaseRecipe): +class Recipe(BasePerfTestTweakMixin, BasePerfTestIterationTweakMixin, BaseRecipe): def perf_test(self, recipe_conf): results = RecipeResults(recipe_conf)
for i in range(recipe_conf.iterations):
self.apply_perf_test_iteration_tweak(recipe_conf)
self.describe_perf_test_iteration_tweak(recipe_conf)
try:
for measurement in recipe_conf.measurements:
measurement.start()
for measurement in reversed(recipe_conf.measurements):
measurement.finish()
for measurement in recipe_conf.measurements:
measurement_results = measurement.collect_results()
results.add_measurement_results(
measurement, measurement_results)
finally:
self.remove_perf_test_iteration_tweak(recipe_conf)
self.apply_perf_test_tweak(recipe_conf)
self.describe_perf_test_tweak(recipe_conf)
try:
for i in range(recipe_conf.iterations):
Minor comment here, so only apply if there will be a v2.
I think at this point I would refactor this a bit due to "too many levels of nesting" I think a new method for "one measurement iteration" could help here and ensure that there's a single try-except-finally block per method.
-Ondrej
self.apply_perf_test_iteration_tweak(recipe_conf)
self.describe_perf_test_iteration_tweak(recipe_conf)
try:
for measurement in recipe_conf.measurements:
measurement.start()
for measurement in reversed(recipe_conf.measurements):
measurement.finish()
for measurement in recipe_conf.measurements:
measurement_results = measurement.collect_results()
results.add_measurement_results(
measurement, measurement_results)
finally:
self.remove_perf_test_iteration_tweak(recipe_conf)
finally:
self.remove_perf_test_tweak(recipe_conf) return results
diff --git a/lnst/Recipes/ENRT/BaseEnrtRecipe.py b/lnst/Recipes/ENRT/BaseEnrtRecipe.py index d629b726..180f922e 100644 --- a/lnst/Recipes/ENRT/BaseEnrtRecipe.py +++ b/lnst/Recipes/ENRT/BaseEnrtRecipe.py @@ -355,13 +355,8 @@ class BaseEnrtRecipe(CommonPerfTestTweakMixin, methods to execute, report and evaluate the results. """ for perf_config in self.generate_perf_configurations(recipe_config):
self.apply_perf_test_tweak(perf_config)
self.describe_perf_test_tweak(perf_config)
try:
result = self.perf_test(perf_config)
self.perf_report_and_evaluate(result)
finally:
self.remove_perf_test_tweak(perf_config)
result = self.perf_test(perf_config)
self.perf_report_and_evaluate(result)
def generate_ping_configurations(self, config): """Base ping test configuration generator
diff --git a/lnst/Recipes/ENRT/PerfTestMixins/SctpFirewallPerfTestMixin.py b/lnst/Recipes/ENRT/PerfTestMixins/SctpFirewallPerfTestMixin.py index c0520405..841df3f7 100644 --- a/lnst/Recipes/ENRT/PerfTestMixins/SctpFirewallPerfTestMixin.py +++ b/lnst/Recipes/ENRT/PerfTestMixins/SctpFirewallPerfTestMixin.py @@ -1,5 +1,5 @@ from lnst.Controller.RecipeResults import ResultLevel -from lnst.Recipes.ENRT.PerfTestMixins import BasePerfTestTweakMixin +from lnst.RecipeCommon.Perf.PerfTestMixins import BasePerfTestTweakMixin
class SctpFirewallPerfTestMixin(BasePerfTestTweakMixin): def apply_perf_test_tweak(self, perf_config): diff --git a/lnst/Recipes/ENRT/PerfTestMixins/__init__.py b/lnst/Recipes/ENRT/PerfTestMixins/__init__.py index 8a109ad0..addfb641 100644 --- a/lnst/Recipes/ENRT/PerfTestMixins/__init__.py +++ b/lnst/Recipes/ENRT/PerfTestMixins/__init__.py @@ -1,3 +1,2 @@ -from lnst.Recipes.ENRT.PerfTestMixins.BasePerfTestTweakMixin import BasePerfTestTweakMixin from lnst.Recipes.ENRT.PerfTestMixins.SctpFirewallPerfTestMixin import SctpFirewallPerfTestMixin from lnst.Recipes.ENRT.PerfTestMixins.CommonPerfTestTweakMixin import CommonPerfTestTweakMixin -- 2.21.3 _______________________________________________ LNST-developers mailing list -- lnst-developers@lists.fedorahosted.org To unsubscribe send an email to lnst-developers-leave@lists.fedorahosted.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedorahosted.org/archives/list/lnst-developers@lists.fedorahos...
The method will be used by mixin classes derived from both BasePerfTestTweakMixin and BasePerfTestIterationTweakMixin.
Signed-off-by: Jan Tluka jtluka@redhat.com --- .../Perf/PerfTestMixins/BasePerfTestTweakMixin.py | 6 ------ .../ENRT/PerfTestMixins/SctpFirewallPerfTestMixin.py | 5 +++-- lnst/Recipes/ENRT/PerfTestMixins/Utils.py | 5 +++++ 3 files changed, 8 insertions(+), 8 deletions(-) create mode 100644 lnst/Recipes/ENRT/PerfTestMixins/Utils.py
diff --git a/lnst/RecipeCommon/Perf/PerfTestMixins/BasePerfTestTweakMixin.py b/lnst/RecipeCommon/Perf/PerfTestMixins/BasePerfTestTweakMixin.py index 5e008a68..380fc72e 100644 --- a/lnst/RecipeCommon/Perf/PerfTestMixins/BasePerfTestTweakMixin.py +++ b/lnst/RecipeCommon/Perf/PerfTestMixins/BasePerfTestTweakMixin.py @@ -1,5 +1,3 @@ -from lnst.RecipeCommon.Perf.Measurements.BaseFlowMeasurement import BaseFlowMeasurement - class BasePerfTestTweakMixin(object): """ This is a base class that defines common API for specific *perf test* @@ -15,7 +13,3 @@ class BasePerfTestTweakMixin(object): def remove_perf_test_tweak(self, perf_config): # TODO: check if anything left in the perf_config.perf_test_tweak_config pass - - def _get_flow_measurement_from_config(self, perf_config): - flow_measurements = [ m for m in perf_config.measurements if isinstance(m, BaseFlowMeasurement) ] - return flow_measurements[0] diff --git a/lnst/Recipes/ENRT/PerfTestMixins/SctpFirewallPerfTestMixin.py b/lnst/Recipes/ENRT/PerfTestMixins/SctpFirewallPerfTestMixin.py index 841df3f7..42cbf492 100644 --- a/lnst/Recipes/ENRT/PerfTestMixins/SctpFirewallPerfTestMixin.py +++ b/lnst/Recipes/ENRT/PerfTestMixins/SctpFirewallPerfTestMixin.py @@ -1,11 +1,12 @@ from lnst.Controller.RecipeResults import ResultLevel from lnst.RecipeCommon.Perf.PerfTestMixins import BasePerfTestTweakMixin +from lnst.Recipes.ENRT.PerfTestMixins.Utils import get_flow_measurement_from_config
class SctpFirewallPerfTestMixin(BasePerfTestTweakMixin): def apply_perf_test_tweak(self, perf_config): super().apply_perf_test_tweak(perf_config)
- flow_measurement = self._get_flow_measurement_from_config(perf_config) + flow_measurement = get_flow_measurement_from_config(perf_config) flow = flow_measurement.conf[0] if flow.type == "sctp_stream": for nic in [flow.generator_nic, flow.receiver_nic]: @@ -18,7 +19,7 @@ class SctpFirewallPerfTestMixin(BasePerfTestTweakMixin): tweak_config["iptables_sctp"] = True
def remove_perf_test_tweak(self, perf_config): - flow_measurement = self._get_flow_measurement_from_config(perf_config) + flow_measurement = get_flow_measurement_from_config(perf_config) flow = flow_measurement.conf[0] if flow.type == "sctp_stream": for nic in [flow.generator_nic, flow.receiver_nic]: diff --git a/lnst/Recipes/ENRT/PerfTestMixins/Utils.py b/lnst/Recipes/ENRT/PerfTestMixins/Utils.py new file mode 100644 index 00000000..9f6f167e --- /dev/null +++ b/lnst/Recipes/ENRT/PerfTestMixins/Utils.py @@ -0,0 +1,5 @@ +from lnst.RecipeCommon.Perf.Measurements.BaseFlowMeasurement import BaseFlowMeasurement + +def get_flow_measurement_from_config(perf_config): + flow_measurements = [ m for m in perf_config.measurements if isinstance(m, BaseFlowMeasurement) ] + return flow_measurements[0]
On Fri, Oct 30, 2020 at 09:30:45AM +0100, Jan Tluka wrote:
The method will be used by mixin classes derived from both BasePerfTestTweakMixin and BasePerfTestIterationTweakMixin.
Signed-off-by: Jan Tluka jtluka@redhat.com
.../Perf/PerfTestMixins/BasePerfTestTweakMixin.py | 6 ------ .../ENRT/PerfTestMixins/SctpFirewallPerfTestMixin.py | 5 +++-- lnst/Recipes/ENRT/PerfTestMixins/Utils.py | 5 +++++ 3 files changed, 8 insertions(+), 8 deletions(-) create mode 100644 lnst/Recipes/ENRT/PerfTestMixins/Utils.py
diff --git a/lnst/RecipeCommon/Perf/PerfTestMixins/BasePerfTestTweakMixin.py b/lnst/RecipeCommon/Perf/PerfTestMixins/BasePerfTestTweakMixin.py index 5e008a68..380fc72e 100644 --- a/lnst/RecipeCommon/Perf/PerfTestMixins/BasePerfTestTweakMixin.py +++ b/lnst/RecipeCommon/Perf/PerfTestMixins/BasePerfTestTweakMixin.py @@ -1,5 +1,3 @@ -from lnst.RecipeCommon.Perf.Measurements.BaseFlowMeasurement import BaseFlowMeasurement
class BasePerfTestTweakMixin(object): """ This is a base class that defines common API for specific *perf test* @@ -15,7 +13,3 @@ class BasePerfTestTweakMixin(object): def remove_perf_test_tweak(self, perf_config): # TODO: check if anything left in the perf_config.perf_test_tweak_config pass
- def _get_flow_measurement_from_config(self, perf_config):
flow_measurements = [ m for m in perf_config.measurements if isinstance(m, BaseFlowMeasurement) ]
return flow_measurements[0]
diff --git a/lnst/Recipes/ENRT/PerfTestMixins/SctpFirewallPerfTestMixin.py b/lnst/Recipes/ENRT/PerfTestMixins/SctpFirewallPerfTestMixin.py index 841df3f7..42cbf492 100644 --- a/lnst/Recipes/ENRT/PerfTestMixins/SctpFirewallPerfTestMixin.py +++ b/lnst/Recipes/ENRT/PerfTestMixins/SctpFirewallPerfTestMixin.py @@ -1,11 +1,12 @@ from lnst.Controller.RecipeResults import ResultLevel from lnst.RecipeCommon.Perf.PerfTestMixins import BasePerfTestTweakMixin +from lnst.Recipes.ENRT.PerfTestMixins.Utils import get_flow_measurement_from_config
class SctpFirewallPerfTestMixin(BasePerfTestTweakMixin): def apply_perf_test_tweak(self, perf_config): super().apply_perf_test_tweak(perf_config)
flow_measurement = self._get_flow_measurement_from_config(perf_config)
flow_measurement = get_flow_measurement_from_config(perf_config) flow = flow_measurement.conf[0] if flow.type == "sctp_stream": for nic in [flow.generator_nic, flow.receiver_nic]:
@@ -18,7 +19,7 @@ class SctpFirewallPerfTestMixin(BasePerfTestTweakMixin): tweak_config["iptables_sctp"] = True
def remove_perf_test_tweak(self, perf_config):
flow_measurement = self._get_flow_measurement_from_config(perf_config)
flow_measurement = get_flow_measurement_from_config(perf_config) flow = flow_measurement.conf[0] if flow.type == "sctp_stream": for nic in [flow.generator_nic, flow.receiver_nic]:
diff --git a/lnst/Recipes/ENRT/PerfTestMixins/Utils.py b/lnst/Recipes/ENRT/PerfTestMixins/Utils.py new file mode 100644 index 00000000..9f6f167e --- /dev/null +++ b/lnst/Recipes/ENRT/PerfTestMixins/Utils.py @@ -0,0 +1,5 @@ +from lnst.RecipeCommon.Perf.Measurements.BaseFlowMeasurement import BaseFlowMeasurement
+def get_flow_measurement_from_config(perf_config):
- flow_measurements = [ m for m in perf_config.measurements if isinstance(m, BaseFlowMeasurement) ]
- return flow_measurements[0]
I'm a bit worried about extending the use of the function and also burying it "deeper" into a "utils" module while the function returns a specific [0] value.
I know that currently we only have a single FlowMeasurement in the list, but if we ever add more than one, this could become quite a complicated thing to find/debug.
Would it make more sense to have this as a "get_...measurementS..." method, return all of the flow measurements and then, for now, pick the [0] directly the the place where it's being used?
Optionally maybe renaming the method to get_first_flow_measurement... could also work and make it more obvious what's happening.
-Ondrej
-- 2.21.3 _______________________________________________ LNST-developers mailing list -- lnst-developers@lists.fedorahosted.org To unsubscribe send an email to lnst-developers-leave@lists.fedorahosted.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedorahosted.org/archives/list/lnst-developers@lists.fedorahos...
Fri, Oct 30, 2020 at 12:59:06PM CET, olichtne@redhat.com wrote:
On Fri, Oct 30, 2020 at 09:30:45AM +0100, Jan Tluka wrote:
The method will be used by mixin classes derived from both BasePerfTestTweakMixin and BasePerfTestIterationTweakMixin.
Signed-off-by: Jan Tluka jtluka@redhat.com
.../Perf/PerfTestMixins/BasePerfTestTweakMixin.py | 6 ------ .../ENRT/PerfTestMixins/SctpFirewallPerfTestMixin.py | 5 +++-- lnst/Recipes/ENRT/PerfTestMixins/Utils.py | 5 +++++ 3 files changed, 8 insertions(+), 8 deletions(-) create mode 100644 lnst/Recipes/ENRT/PerfTestMixins/Utils.py
diff --git a/lnst/RecipeCommon/Perf/PerfTestMixins/BasePerfTestTweakMixin.py b/lnst/RecipeCommon/Perf/PerfTestMixins/BasePerfTestTweakMixin.py index 5e008a68..380fc72e 100644 --- a/lnst/RecipeCommon/Perf/PerfTestMixins/BasePerfTestTweakMixin.py +++ b/lnst/RecipeCommon/Perf/PerfTestMixins/BasePerfTestTweakMixin.py @@ -1,5 +1,3 @@ -from lnst.RecipeCommon.Perf.Measurements.BaseFlowMeasurement import BaseFlowMeasurement
class BasePerfTestTweakMixin(object): """ This is a base class that defines common API for specific *perf test* @@ -15,7 +13,3 @@ class BasePerfTestTweakMixin(object): def remove_perf_test_tweak(self, perf_config): # TODO: check if anything left in the perf_config.perf_test_tweak_config pass
- def _get_flow_measurement_from_config(self, perf_config):
flow_measurements = [ m for m in perf_config.measurements if isinstance(m, BaseFlowMeasurement) ]
return flow_measurements[0]
diff --git a/lnst/Recipes/ENRT/PerfTestMixins/SctpFirewallPerfTestMixin.py b/lnst/Recipes/ENRT/PerfTestMixins/SctpFirewallPerfTestMixin.py index 841df3f7..42cbf492 100644 --- a/lnst/Recipes/ENRT/PerfTestMixins/SctpFirewallPerfTestMixin.py +++ b/lnst/Recipes/ENRT/PerfTestMixins/SctpFirewallPerfTestMixin.py @@ -1,11 +1,12 @@ from lnst.Controller.RecipeResults import ResultLevel from lnst.RecipeCommon.Perf.PerfTestMixins import BasePerfTestTweakMixin +from lnst.Recipes.ENRT.PerfTestMixins.Utils import get_flow_measurement_from_config
class SctpFirewallPerfTestMixin(BasePerfTestTweakMixin): def apply_perf_test_tweak(self, perf_config): super().apply_perf_test_tweak(perf_config)
flow_measurement = self._get_flow_measurement_from_config(perf_config)
flow_measurement = get_flow_measurement_from_config(perf_config) flow = flow_measurement.conf[0] if flow.type == "sctp_stream": for nic in [flow.generator_nic, flow.receiver_nic]:
@@ -18,7 +19,7 @@ class SctpFirewallPerfTestMixin(BasePerfTestTweakMixin): tweak_config["iptables_sctp"] = True
def remove_perf_test_tweak(self, perf_config):
flow_measurement = self._get_flow_measurement_from_config(perf_config)
flow_measurement = get_flow_measurement_from_config(perf_config) flow = flow_measurement.conf[0] if flow.type == "sctp_stream": for nic in [flow.generator_nic, flow.receiver_nic]:
diff --git a/lnst/Recipes/ENRT/PerfTestMixins/Utils.py b/lnst/Recipes/ENRT/PerfTestMixins/Utils.py new file mode 100644 index 00000000..9f6f167e --- /dev/null +++ b/lnst/Recipes/ENRT/PerfTestMixins/Utils.py @@ -0,0 +1,5 @@ +from lnst.RecipeCommon.Perf.Measurements.BaseFlowMeasurement import BaseFlowMeasurement
+def get_flow_measurement_from_config(perf_config):
- flow_measurements = [ m for m in perf_config.measurements if isinstance(m, BaseFlowMeasurement) ]
- return flow_measurements[0]
I'm a bit worried about extending the use of the function and also burying it "deeper" into a "utils" module while the function returns a specific [0] value.
I know that currently we only have a single FlowMeasurement in the list, but if we ever add more than one, this could become quite a complicated thing to find/debug.
Would it make more sense to have this as a "get_...measurementS..." method, return all of the flow measurements and then, for now, pick the [0] directly the the place where it's being used?
Makes sense. So, when you say to have this as a method, you mean a class method, correct? I will need to create a base class for PerfTest and PerfTestIteration classes that would share this method (which is ok).
Optionally maybe renaming the method to get_first_flow_measurement... could also work and make it more obvious what's happening.
-Ondrej
-- 2.21.3 _______________________________________________ LNST-developers mailing list -- lnst-developers@lists.fedorahosted.org To unsubscribe send an email to lnst-developers-leave@lists.fedorahosted.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedorahosted.org/archives/list/lnst-developers@lists.fedorahos...
On Fri, Oct 30, 2020 at 01:25:47PM +0100, Jan Tluka wrote:
Fri, Oct 30, 2020 at 12:59:06PM CET, olichtne@redhat.com wrote:
On Fri, Oct 30, 2020 at 09:30:45AM +0100, Jan Tluka wrote:
The method will be used by mixin classes derived from both BasePerfTestTweakMixin and BasePerfTestIterationTweakMixin.
Signed-off-by: Jan Tluka jtluka@redhat.com
.../Perf/PerfTestMixins/BasePerfTestTweakMixin.py | 6 ------ .../ENRT/PerfTestMixins/SctpFirewallPerfTestMixin.py | 5 +++-- lnst/Recipes/ENRT/PerfTestMixins/Utils.py | 5 +++++ 3 files changed, 8 insertions(+), 8 deletions(-) create mode 100644 lnst/Recipes/ENRT/PerfTestMixins/Utils.py
diff --git a/lnst/RecipeCommon/Perf/PerfTestMixins/BasePerfTestTweakMixin.py b/lnst/RecipeCommon/Perf/PerfTestMixins/BasePerfTestTweakMixin.py index 5e008a68..380fc72e 100644 --- a/lnst/RecipeCommon/Perf/PerfTestMixins/BasePerfTestTweakMixin.py +++ b/lnst/RecipeCommon/Perf/PerfTestMixins/BasePerfTestTweakMixin.py @@ -1,5 +1,3 @@ -from lnst.RecipeCommon.Perf.Measurements.BaseFlowMeasurement import BaseFlowMeasurement
class BasePerfTestTweakMixin(object): """ This is a base class that defines common API for specific *perf test* @@ -15,7 +13,3 @@ class BasePerfTestTweakMixin(object): def remove_perf_test_tweak(self, perf_config): # TODO: check if anything left in the perf_config.perf_test_tweak_config pass
- def _get_flow_measurement_from_config(self, perf_config):
flow_measurements = [ m for m in perf_config.measurements if isinstance(m, BaseFlowMeasurement) ]
return flow_measurements[0]
diff --git a/lnst/Recipes/ENRT/PerfTestMixins/SctpFirewallPerfTestMixin.py b/lnst/Recipes/ENRT/PerfTestMixins/SctpFirewallPerfTestMixin.py index 841df3f7..42cbf492 100644 --- a/lnst/Recipes/ENRT/PerfTestMixins/SctpFirewallPerfTestMixin.py +++ b/lnst/Recipes/ENRT/PerfTestMixins/SctpFirewallPerfTestMixin.py @@ -1,11 +1,12 @@ from lnst.Controller.RecipeResults import ResultLevel from lnst.RecipeCommon.Perf.PerfTestMixins import BasePerfTestTweakMixin +from lnst.Recipes.ENRT.PerfTestMixins.Utils import get_flow_measurement_from_config
class SctpFirewallPerfTestMixin(BasePerfTestTweakMixin): def apply_perf_test_tweak(self, perf_config): super().apply_perf_test_tweak(perf_config)
flow_measurement = self._get_flow_measurement_from_config(perf_config)
flow_measurement = get_flow_measurement_from_config(perf_config) flow = flow_measurement.conf[0] if flow.type == "sctp_stream": for nic in [flow.generator_nic, flow.receiver_nic]:
@@ -18,7 +19,7 @@ class SctpFirewallPerfTestMixin(BasePerfTestTweakMixin): tweak_config["iptables_sctp"] = True
def remove_perf_test_tweak(self, perf_config):
flow_measurement = self._get_flow_measurement_from_config(perf_config)
flow_measurement = get_flow_measurement_from_config(perf_config) flow = flow_measurement.conf[0] if flow.type == "sctp_stream": for nic in [flow.generator_nic, flow.receiver_nic]:
diff --git a/lnst/Recipes/ENRT/PerfTestMixins/Utils.py b/lnst/Recipes/ENRT/PerfTestMixins/Utils.py new file mode 100644 index 00000000..9f6f167e --- /dev/null +++ b/lnst/Recipes/ENRT/PerfTestMixins/Utils.py @@ -0,0 +1,5 @@ +from lnst.RecipeCommon.Perf.Measurements.BaseFlowMeasurement import BaseFlowMeasurement
+def get_flow_measurement_from_config(perf_config):
- flow_measurements = [ m for m in perf_config.measurements if isinstance(m, BaseFlowMeasurement) ]
- return flow_measurements[0]
I'm a bit worried about extending the use of the function and also burying it "deeper" into a "utils" module while the function returns a specific [0] value.
I know that currently we only have a single FlowMeasurement in the list, but if we ever add more than one, this could become quite a complicated thing to find/debug.
Would it make more sense to have this as a "get_...measurementS..." method, return all of the flow measurements and then, for now, pick the [0] directly the the place where it's being used?
Makes sense. So, when you say to have this as a method, you mean a class method, correct? I will need to create a base class for PerfTest and PerfTestIteration classes that would share this method (which is ok).
Sorry, got my method vs function words confused, I'm ok with keeping this as a function in the Utils module. No need for a new base class, I don't think it's a good idea to merge distinct mixin classes with a common base class...
-Ondrej
Optionally maybe renaming the method to get_first_flow_measurement... could also work and make it more obvious what's happening.
-Ondrej
-- 2.21.3 _______________________________________________ LNST-developers mailing list -- lnst-developers@lists.fedorahosted.org To unsubscribe send an email to lnst-developers-leave@lists.fedorahosted.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedorahosted.org/archives/list/lnst-developers@lists.fedorahos...
This mixin class can be used to drop vm caches before each iteration of the performance test measurements.
Signed-off-by: Jan Tluka jtluka@redhat.com --- .../PerfTestMixins/DropCachesPerfTestMixin.py | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 lnst/Recipes/ENRT/PerfTestMixins/DropCachesPerfTestMixin.py
diff --git a/lnst/Recipes/ENRT/PerfTestMixins/DropCachesPerfTestMixin.py b/lnst/Recipes/ENRT/PerfTestMixins/DropCachesPerfTestMixin.py new file mode 100644 index 00000000..2ee784c3 --- /dev/null +++ b/lnst/Recipes/ENRT/PerfTestMixins/DropCachesPerfTestMixin.py @@ -0,0 +1,36 @@ +from lnst.Common.Parameters import BoolParam +from lnst.RecipeCommon.Perf.PerfTestMixins import BasePerfTestIterationTweakMixin +from lnst.Recipes.ENRT.PerfTestMixins.Utils import get_flow_measurement_from_config + +class DropCachesPerfTestMixin(BasePerfTestIterationTweakMixin): + """ + This mixin class is an extension to the :any:`BaseEnrtRecipe` class that can + be used to drop vm caches before running each iteration of the performance + measurements. + + :param drop_caches: + (optional test parameter) a boolean, if set to True, the memory caches + are dropped otherwise the mixin has no effect + """ + + drop_caches = BoolParam(default=False) + + def generate_perf_test_iteration_tweak_description(self, perf_config): + description = super().generate_perf_test_iteration_tweak_description(perf_config) + if self.params.drop_caches: + description.append("dropped vm caches before iteration") + else: + description.append("skipped dropping vm caches before iteration") + return description + + def apply_perf_test_iteration_tweak(self, perf_config): + super().apply_perf_test_iteration_tweak(perf_config) + + if self.params.drop_caches: + flow_measurement = get_flow_measurement_from_config(perf_config) + flow = flow_measurement.conf[0] + for host in [flow.generator, flow.receiver]: + host.run("echo 1 > /proc/sys/vm/drop_caches") + + def remove_perf_test_iteration_tweak(self, perf_config): + super().remove_perf_test_iteration_tweak(perf_config)
On Fri, Oct 30, 2020 at 09:30:46AM +0100, Jan Tluka wrote:
This mixin class can be used to drop vm caches before each iteration of the performance test measurements.
Signed-off-by: Jan Tluka jtluka@redhat.com
.../PerfTestMixins/DropCachesPerfTestMixin.py | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 lnst/Recipes/ENRT/PerfTestMixins/DropCachesPerfTestMixin.py
diff --git a/lnst/Recipes/ENRT/PerfTestMixins/DropCachesPerfTestMixin.py b/lnst/Recipes/ENRT/PerfTestMixins/DropCachesPerfTestMixin.py new file mode 100644 index 00000000..2ee784c3 --- /dev/null +++ b/lnst/Recipes/ENRT/PerfTestMixins/DropCachesPerfTestMixin.py @@ -0,0 +1,36 @@ +from lnst.Common.Parameters import BoolParam +from lnst.RecipeCommon.Perf.PerfTestMixins import BasePerfTestIterationTweakMixin +from lnst.Recipes.ENRT.PerfTestMixins.Utils import get_flow_measurement_from_config
+class DropCachesPerfTestMixin(BasePerfTestIterationTweakMixin):
- """
- This mixin class is an extension to the :any:`BaseEnrtRecipe` class that can
- be used to drop vm caches before running each iteration of the performance
- measurements.
- :param drop_caches:
(optional test parameter) a boolean, if set to True, the memory caches
are dropped otherwise the mixin has no effect
- """
- drop_caches = BoolParam(default=False)
- def generate_perf_test_iteration_tweak_description(self, perf_config):
description = super().generate_perf_test_iteration_tweak_description(perf_config)
if self.params.drop_caches:
description.append("dropped vm caches before iteration")
else:
description.append("skipped dropping vm caches before iteration")
return description
- def apply_perf_test_iteration_tweak(self, perf_config):
super().apply_perf_test_iteration_tweak(perf_config)
if self.params.drop_caches:
flow_measurement = get_flow_measurement_from_config(perf_config)
flow = flow_measurement.conf[0]
for host in [flow.generator, flow.receiver]:
Similar comment to the previous mixins, should we maybe consider dropping caches on more than just the generator+receiver hosts? E.g. in virtual cases, the hypervisors usually configure bridging or other network functions where caches could also come into play.
If yes, I think in this case we don't really need a "...host_list" property, I would just drop cashes on all hosts in the recipe.
-Ondrej
host.run("echo 1 > /proc/sys/vm/drop_caches")
- def remove_perf_test_iteration_tweak(self, perf_config):
super().remove_perf_test_iteration_tweak(perf_config)
-- 2.21.3 _______________________________________________ LNST-developers mailing list -- lnst-developers@lists.fedorahosted.org To unsubscribe send an email to lnst-developers-leave@lists.fedorahosted.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedorahosted.org/archives/list/lnst-developers@lists.fedorahos...
Fri, Oct 30, 2020 at 01:02:14PM CET, olichtne@redhat.com wrote:
On Fri, Oct 30, 2020 at 09:30:46AM +0100, Jan Tluka wrote:
This mixin class can be used to drop vm caches before each iteration of the performance test measurements.
Signed-off-by: Jan Tluka jtluka@redhat.com
.../PerfTestMixins/DropCachesPerfTestMixin.py | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 lnst/Recipes/ENRT/PerfTestMixins/DropCachesPerfTestMixin.py
diff --git a/lnst/Recipes/ENRT/PerfTestMixins/DropCachesPerfTestMixin.py b/lnst/Recipes/ENRT/PerfTestMixins/DropCachesPerfTestMixin.py new file mode 100644 index 00000000..2ee784c3 --- /dev/null +++ b/lnst/Recipes/ENRT/PerfTestMixins/DropCachesPerfTestMixin.py @@ -0,0 +1,36 @@ +from lnst.Common.Parameters import BoolParam +from lnst.RecipeCommon.Perf.PerfTestMixins import BasePerfTestIterationTweakMixin +from lnst.Recipes.ENRT.PerfTestMixins.Utils import get_flow_measurement_from_config
+class DropCachesPerfTestMixin(BasePerfTestIterationTweakMixin):
- """
- This mixin class is an extension to the :any:`BaseEnrtRecipe` class that can
- be used to drop vm caches before running each iteration of the performance
- measurements.
- :param drop_caches:
(optional test parameter) a boolean, if set to True, the memory caches
are dropped otherwise the mixin has no effect
- """
- drop_caches = BoolParam(default=False)
- def generate_perf_test_iteration_tweak_description(self, perf_config):
description = super().generate_perf_test_iteration_tweak_description(perf_config)
if self.params.drop_caches:
description.append("dropped vm caches before iteration")
else:
description.append("skipped dropping vm caches before iteration")
return description
- def apply_perf_test_iteration_tweak(self, perf_config):
super().apply_perf_test_iteration_tweak(perf_config)
if self.params.drop_caches:
flow_measurement = get_flow_measurement_from_config(perf_config)
flow = flow_measurement.conf[0]
for host in [flow.generator, flow.receiver]:
Similar comment to the previous mixins, should we maybe consider dropping caches on more than just the generator+receiver hosts? E.g. in virtual cases, the hypervisors usually configure bridging or other network functions where caches could also come into play.
If yes, I think in this case we don't really need a "...host_list" property, I would just drop cashes on all hosts in the recipe.
-Ondrej
Good point. I'll change it.
I'm not quite sure if we can do that without the host_list property, because we have no recipe handle from within the mixin.
host.run("echo 1 > /proc/sys/vm/drop_caches")
- def remove_perf_test_iteration_tweak(self, perf_config):
super().remove_perf_test_iteration_tweak(perf_config)
-- 2.21.3 _______________________________________________ LNST-developers mailing list -- lnst-developers@lists.fedorahosted.org To unsubscribe send an email to lnst-developers-leave@lists.fedorahosted.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedorahosted.org/archives/list/lnst-developers@lists.fedorahos...
On Fri, Oct 30, 2020 at 01:20:40PM +0100, Jan Tluka wrote:
Fri, Oct 30, 2020 at 01:02:14PM CET, olichtne@redhat.com wrote:
On Fri, Oct 30, 2020 at 09:30:46AM +0100, Jan Tluka wrote:
This mixin class can be used to drop vm caches before each iteration of the performance test measurements.
Signed-off-by: Jan Tluka jtluka@redhat.com
.../PerfTestMixins/DropCachesPerfTestMixin.py | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 lnst/Recipes/ENRT/PerfTestMixins/DropCachesPerfTestMixin.py
diff --git a/lnst/Recipes/ENRT/PerfTestMixins/DropCachesPerfTestMixin.py b/lnst/Recipes/ENRT/PerfTestMixins/DropCachesPerfTestMixin.py new file mode 100644 index 00000000..2ee784c3 --- /dev/null +++ b/lnst/Recipes/ENRT/PerfTestMixins/DropCachesPerfTestMixin.py @@ -0,0 +1,36 @@ +from lnst.Common.Parameters import BoolParam +from lnst.RecipeCommon.Perf.PerfTestMixins import BasePerfTestIterationTweakMixin +from lnst.Recipes.ENRT.PerfTestMixins.Utils import get_flow_measurement_from_config
+class DropCachesPerfTestMixin(BasePerfTestIterationTweakMixin):
- """
- This mixin class is an extension to the :any:`BaseEnrtRecipe` class that can
- be used to drop vm caches before running each iteration of the performance
- measurements.
- :param drop_caches:
(optional test parameter) a boolean, if set to True, the memory caches
are dropped otherwise the mixin has no effect
- """
- drop_caches = BoolParam(default=False)
- def generate_perf_test_iteration_tweak_description(self, perf_config):
description = super().generate_perf_test_iteration_tweak_description(perf_config)
if self.params.drop_caches:
description.append("dropped vm caches before iteration")
else:
description.append("skipped dropping vm caches before iteration")
return description
- def apply_perf_test_iteration_tweak(self, perf_config):
super().apply_perf_test_iteration_tweak(perf_config)
if self.params.drop_caches:
flow_measurement = get_flow_measurement_from_config(perf_config)
flow = flow_measurement.conf[0]
for host in [flow.generator, flow.receiver]:
Similar comment to the previous mixins, should we maybe consider dropping caches on more than just the generator+receiver hosts? E.g. in virtual cases, the hypervisors usually configure bridging or other network functions where caches could also come into play.
If yes, I think in this case we don't really need a "...host_list" property, I would just drop cashes on all hosts in the recipe.
-Ondrej
Good point. I'll change it.
I'm not quite sure if we can do that without the host_list property, because we have no recipe handle from within the mixin.
you can, because it's a Recipe mixin it means that it will be mixed into a class that inherits from BaseRecipe class and therefore the 'self' references an instance that inherits from it. So you can just call self.matched here.
-Ondrej
host.run("echo 1 > /proc/sys/vm/drop_caches")
- def remove_perf_test_iteration_tweak(self, perf_config):
super().remove_perf_test_iteration_tweak(perf_config)
-- 2.21.3 _______________________________________________ LNST-developers mailing list -- lnst-developers@lists.fedorahosted.org To unsubscribe send an email to lnst-developers-leave@lists.fedorahosted.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedorahosted.org/archives/list/lnst-developers@lists.fedorahos...
Fri, Oct 30, 2020 at 01:26:38PM CET, olichtne@redhat.com wrote:
On Fri, Oct 30, 2020 at 01:20:40PM +0100, Jan Tluka wrote:
Fri, Oct 30, 2020 at 01:02:14PM CET, olichtne@redhat.com wrote:
On Fri, Oct 30, 2020 at 09:30:46AM +0100, Jan Tluka wrote:
This mixin class can be used to drop vm caches before each iteration of the performance test measurements.
Signed-off-by: Jan Tluka jtluka@redhat.com
.../PerfTestMixins/DropCachesPerfTestMixin.py | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 lnst/Recipes/ENRT/PerfTestMixins/DropCachesPerfTestMixin.py
diff --git a/lnst/Recipes/ENRT/PerfTestMixins/DropCachesPerfTestMixin.py b/lnst/Recipes/ENRT/PerfTestMixins/DropCachesPerfTestMixin.py new file mode 100644 index 00000000..2ee784c3 --- /dev/null +++ b/lnst/Recipes/ENRT/PerfTestMixins/DropCachesPerfTestMixin.py @@ -0,0 +1,36 @@ +from lnst.Common.Parameters import BoolParam +from lnst.RecipeCommon.Perf.PerfTestMixins import BasePerfTestIterationTweakMixin +from lnst.Recipes.ENRT.PerfTestMixins.Utils import get_flow_measurement_from_config
+class DropCachesPerfTestMixin(BasePerfTestIterationTweakMixin):
- """
- This mixin class is an extension to the :any:`BaseEnrtRecipe` class that can
- be used to drop vm caches before running each iteration of the performance
- measurements.
- :param drop_caches:
(optional test parameter) a boolean, if set to True, the memory caches
are dropped otherwise the mixin has no effect
- """
- drop_caches = BoolParam(default=False)
- def generate_perf_test_iteration_tweak_description(self, perf_config):
description = super().generate_perf_test_iteration_tweak_description(perf_config)
if self.params.drop_caches:
description.append("dropped vm caches before iteration")
else:
description.append("skipped dropping vm caches before iteration")
return description
- def apply_perf_test_iteration_tweak(self, perf_config):
super().apply_perf_test_iteration_tweak(perf_config)
if self.params.drop_caches:
flow_measurement = get_flow_measurement_from_config(perf_config)
flow = flow_measurement.conf[0]
for host in [flow.generator, flow.receiver]:
Similar comment to the previous mixins, should we maybe consider dropping caches on more than just the generator+receiver hosts? E.g. in virtual cases, the hypervisors usually configure bridging or other network functions where caches could also come into play.
If yes, I think in this case we don't really need a "...host_list" property, I would just drop cashes on all hosts in the recipe.
-Ondrej
Good point. I'll change it.
I'm not quite sure if we can do that without the host_list property, because we have no recipe handle from within the mixin.
you can, because it's a Recipe mixin it means that it will be mixed into a class that inherits from BaseRecipe class and therefore the 'self' references an instance that inherits from it. So you can just call self.matched here.
-Ondrej
Ok, I was not sure if this is the correct way to use a mixin. But it makes sense with your explanation. Then, it's easy to change this.
host.run("echo 1 > /proc/sys/vm/drop_caches")
- def remove_perf_test_iteration_tweak(self, perf_config):
super().remove_perf_test_iteration_tweak(perf_config)
-- 2.21.3 _______________________________________________ LNST-developers mailing list -- lnst-developers@lists.fedorahosted.org To unsubscribe send an email to lnst-developers-leave@lists.fedorahosted.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedorahosted.org/archives/list/lnst-developers@lists.fedorahos...
Signed-off-by: Jan Tluka jtluka@redhat.com --- lnst/Recipes/ENRT/PerfTestMixins/CommonPerfTestTweakMixin.py | 3 ++- lnst/Recipes/ENRT/PerfTestMixins/__init__.py | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/lnst/Recipes/ENRT/PerfTestMixins/CommonPerfTestTweakMixin.py b/lnst/Recipes/ENRT/PerfTestMixins/CommonPerfTestTweakMixin.py index 7606ef90..ebe59656 100644 --- a/lnst/Recipes/ENRT/PerfTestMixins/CommonPerfTestTweakMixin.py +++ b/lnst/Recipes/ENRT/PerfTestMixins/CommonPerfTestTweakMixin.py @@ -1,6 +1,7 @@ from lnst.Recipes.ENRT.PerfTestMixins import ( SctpFirewallPerfTestMixin, + DropCachesPerfTestMixin, )
-class CommonPerfTestTweakMixin(SctpFirewallPerfTestMixin): +class CommonPerfTestTweakMixin(SctpFirewallPerfTestMixin, DropCachesPerfTestMixin): pass diff --git a/lnst/Recipes/ENRT/PerfTestMixins/__init__.py b/lnst/Recipes/ENRT/PerfTestMixins/__init__.py index addfb641..93709ad2 100644 --- a/lnst/Recipes/ENRT/PerfTestMixins/__init__.py +++ b/lnst/Recipes/ENRT/PerfTestMixins/__init__.py @@ -1,2 +1,3 @@ from lnst.Recipes.ENRT.PerfTestMixins.SctpFirewallPerfTestMixin import SctpFirewallPerfTestMixin +from lnst.Recipes.ENRT.PerfTestMixins.DropCachesPerfTestMixin import DropCachesPerfTestMixin from lnst.Recipes.ENRT.PerfTestMixins.CommonPerfTestTweakMixin import CommonPerfTestTweakMixin
lnst-developers@lists.fedorahosted.org