Tue, Feb 23, 2021 at 01:47:51PM CET, olichtne(a)redhat.com wrote:
On Thu, Feb 18, 2021 at 01:58:41PM +0100, Jan Tluka wrote:
> IperfFlowMeasurement can measure multiple Flows at the same time and will
> produce multiple FlowMeasurementResults.
>
> To be able to report and evaluate sum of the flows a new method
> aggregate_multi_flow_results is added to support these actions.
> The method creates a new AggregatedFlowMeasurementResults object
> that will collect iteration data results of each Flow and
> transform the data into additional ParallelPerfResult layer.
>
> Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
> ---
> .../Perf/Measurements/IperfFlowMeasurement.py | 55 ++++++++++++++++++-
> 1 file changed, 52 insertions(+), 3 deletions(-)
>
> diff --git a/lnst/RecipeCommon/Perf/Measurements/IperfFlowMeasurement.py
b/lnst/RecipeCommon/Perf/Measurements/IperfFlowMeasurement.py
> index 3b24aa58..0e1dff5e 100644
> --- a/lnst/RecipeCommon/Perf/Measurements/IperfFlowMeasurement.py
> +++ b/lnst/RecipeCommon/Perf/Measurements/IperfFlowMeasurement.py
> @@ -9,9 +9,13 @@ from lnst.Controller.RecipeResults import ResultLevel
> from lnst.RecipeCommon.Perf.Results import PerfInterval
> from lnst.RecipeCommon.Perf.Results import SequentialPerfResult
> from lnst.RecipeCommon.Perf.Results import ParallelPerfResult
> -from lnst.RecipeCommon.Perf.Measurements.BaseFlowMeasurement import NetworkFlowTest
> -from lnst.RecipeCommon.Perf.Measurements.BaseFlowMeasurement import
BaseFlowMeasurement
> -from lnst.RecipeCommon.Perf.Measurements.BaseFlowMeasurement import
FlowMeasurementResults
> +from lnst.RecipeCommon.Perf.Measurements.BaseFlowMeasurement import (
> + NetworkFlowTest,
> + BaseFlowMeasurement,
> + FlowMeasurementResults,
> + AggregatedFlowMeasurementResults,
> + Flow,
> +)
>
> from lnst.RecipeCommon.Perf.Measurements.MeasurementError import MeasurementError
>
> @@ -105,6 +109,51 @@ class IperfFlowMeasurement(BaseFlowMeasurement):
>
> return results
>
I'm not sure about the placement of the "aggregate_multi_flow_results"
method into the IperfFlowMeasurement class because of how you call it
in the following two patches.
The BaselineFlowAverageEvaluator class is *generic* - it can be used for
results generated by any *FlowMeasurement class (including Neper,
Netperf, Trex, whatever else). So if you decide to call
"measurement.aggregate_multi_flow_results" here, it means that the
"aggregate_multi_flow_results" method should be defined as part of the
generic interface for any FlowMeasurement class - so at least an empty
method should be part of the BaseFlowMeasurement class.
At the same time, I see that the method doesn't actually do anything
specific to Iperf at all - so again, it's probably more generic than
what the current placement implies.
One more comment on this is that the method accepts a "self" parameter
that isn't used anywhere, and later you call the method with "cls" as
the value for it. This again implies that the parameter shouldn't be
here at all and the method should be a "staticmethod" and probably
defined in a more generic class than here.
-Ondrej
Makes sense. I will update the patch.
> + def aggregate_multi_flow_results(self, results):
> + if len(results) == 1:
> + return results
> +
> + sample_result = results[0]
> + sample_flow = sample_result.flow
> + dummy_flow = Flow(
> + type=sample_flow.type,
> + generator=sample_flow.generator,
> + generator_bind=sample_flow.generator_bind,
> + generator_nic=sample_flow.generator_nic,
> + receiver=sample_flow.receiver,
> + receiver_bind=sample_flow.receiver_bind,
> + receiver_nic=sample_flow.receiver_nic,
> + receiver_port=None,
> + msg_size=sample_flow.msg_size,
> + duration=sample_flow.duration,
> + parallel_streams=sample_flow.parallel_streams,
> + cpupin=None
> + )
> +
> + aggregated_result = AggregatedFlowMeasurementResults(
> + sample_result.measurement, dummy_flow)
> +
> + nr_iterations = len(sample_result.individual_results)
> + for i in range(nr_iterations):
> + parallel_result = FlowMeasurementResults(
> + measurement=sample_result.measurement,
> + flow=dummy_flow)
> + parallel_result.generator_results = ParallelPerfResult()
> + parallel_result.generator_cpu_stats = ParallelPerfResult()
> + parallel_result.receiver_results = ParallelPerfResult()
> + parallel_result.receiver_cpu_stats = ParallelPerfResult()
> +
> + for result in results:
> + flow_result = result.individual_results[i]
> +
parallel_result.generator_results.append(flow_result.generator_results)
> +
parallel_result.receiver_results.append(flow_result.receiver_results)
> +
parallel_result.generator_cpu_stats.append(flow_result.generator_cpu_stats)
> +
parallel_result.receiver_cpu_stats.append(flow_result.receiver_cpu_stats)
> +
> + aggregated_result.add_results(parallel_result)
> +
> + return [aggregated_result]
> +
> def _prepare_test_flows(self, flows):
> test_flows = []
> for flow in flows:
> --
> 2.26.2
> _______________________________________________
> LNST-developers mailing list -- lnst-developers(a)lists.fedorahosted.org
> To unsubscribe send an email to lnst-developers-leave(a)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.fedora...
> Do not reply to spam on the list, report it:
https://pagure.io/fedora-infrastructure