Skip to content

Commit

Permalink
Perf.Measurements: report measurement_success in MeasurementResult
Browse files Browse the repository at this point in the history
The measurement_success property is now exposed as the result value of
the MeasurementResult object.

Signed-off-by: Ondrej Lichtner <[email protected]>
  • Loading branch information
olichtne committed Nov 20, 2024
1 parent e8cf628 commit b7aa366
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 7 deletions.
15 changes: 13 additions & 2 deletions lnst/RecipeCommon/Perf/Measurements/BaseCPUMeasurement.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from lnst.Controller.RecipeResults import MeasurementResult
from lnst.Controller.RecipeResults import MeasurementResult, ResultType
from lnst.RecipeCommon.Perf.Measurements.MeasurementError import MeasurementError
from lnst.RecipeCommon.Perf.Measurements.BaseMeasurement import BaseMeasurement
from lnst.RecipeCommon.Perf.Measurements.Results import AggregatedCPUMeasurementResults
Expand Down Expand Up @@ -38,7 +38,18 @@ def _report_host_results(cls, recipe, results):

desc = [result.describe() for result in results]

recipe.add_custom_result(MeasurementResult("cpu", description="\n".join(desc), data=cpu_data))
recipe.add_custom_result(
MeasurementResult(
"cpu",
result=(
ResultType.PASS
if results.measurement_success
else ResultType.FAIL
),
description="\n".join(desc),
data=cpu_data,
)
)

def _aggregate_hostcpu_results(self, old, new):
if (old is not None and
Expand Down
5 changes: 3 additions & 2 deletions lnst/RecipeCommon/Perf/Measurements/BaseFlowMeasurement.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,19 @@ def _report_flow_results(cls, recipe, flow_results):
desc = []
desc.append(flow_results.describe())

recipe_result = ResultType.PASS
metrics = {"Generator": generator, "Generator process": generator_cpu,
"Receiver": receiver, "Receiver process": receiver_cpu}
for name, result in metrics.items():
if cls._invalid_flow_duration(result):
recipe_result = ResultType.FAIL
desc.append("{} has invalid duration!".format(name))

# TODO add flow description
recipe_result = MeasurementResult(
"flow",
description="\n".join(desc),
result=(
ResultType.PASS if flow_results.measurement_success else ResultType.FAIL
),
data={
"generator_flow_data": generator,
"generator_cpu_data": generator_cpu,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from lnst.Controller.Job import Job
from lnst.Controller.Recipe import BaseRecipe
from lnst.Controller.RecipeResults import MeasurementResult
from lnst.Controller.RecipeResults import MeasurementResult, ResultType
from lnst.RecipeCommon.Perf.Measurements.BaseFlowMeasurement import Flow, NetworkFlowTest
from lnst.RecipeCommon.Perf.Results import PerfInterval
from lnst.Tests.RDMABandwidth import RDMABandwidthServer, RDMABandwidthClient
Expand Down Expand Up @@ -159,6 +159,11 @@ def report_results(
for aggregated_result in aggregated_results:
measurement_result = MeasurementResult(
"rdma-bandwidth",
result=(
ResultType.PASS
if aggregated_result.measurement_success
else ResultType.FAIL
),
description=aggregated_result.describe(),
data={"bandwidth": aggregated_result.bandwidth}
)
Expand Down
3 changes: 2 additions & 1 deletion lnst/RecipeCommon/Perf/Measurements/TcRunMeasurement.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,10 @@ def report_results(cls, recipe: BaseRecipe, results: list[TcRunMeasurementResult

@classmethod
def _report_result(cls, recipe: BaseRecipe, result: TcRunMeasurementResults):
r_type = ResultType.PASS if result.run_success else ResultType.FAIL
r_type = ResultType.PASS if result.measurement_success else ResultType.FAIL
measurement_result = MeasurementResult(
"tc",
result=r_type,
description=f"{r_type} {result.description}",
data={"rule_install_rate": result.rule_install_rate},
)
Expand Down
7 changes: 6 additions & 1 deletion lnst/RecipeCommon/Perf/Measurements/XDPBenchMeasurement.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from lnst.Tests.PktGen import PktGen
from lnst.Tests.XDPBench import XDPBench
from lnst.Controller.Job import Job
from lnst.Controller.RecipeResults import MeasurementResult
from lnst.Controller.RecipeResults import MeasurementResult, ResultType
from lnst.RecipeCommon.Perf.Measurements.BaseFlowMeasurement import BaseFlowMeasurement


Expand Down Expand Up @@ -225,6 +225,11 @@ def report_results(cls, recipe: BaseRecipe, results: list[AggregatedXDPBenchMeas

recipe_result = MeasurementResult(
"xdp-bench",
result=(
ResultType.PASS
if result.measurement_success
else ResultType.FAIL
),
description="\n".join(desc),
data={
"generator_results": generator,
Expand Down

0 comments on commit b7aa366

Please sign in to comment.