This patch introduces two significant changes.
First one is a change of perf_tool_cpu parameter to ListParam type.
That enables two new test scenarios:
* using multiple cpus for an iperf process - this however cannot be
used due to a limitation of iperf
* specifying a set of multiple cpus that can be assigned to
individual iperf processes based on a "policy"
For the second scenario the patch adds new optional recipe parameter
perf_tool_cpu_policy, that currently supports two values:
* 'round-robin' - each of the iperf processes will be pinned to exactly ONE
cpu from the list defined by perf_tool_cpu on round-robin fashion
* 'all' - each of the iperf processes will be pinned to all cpus
in the list defined by perf_tool_cpu - due to limitations of
iperf this is not possible at the moment
* if the recipe parameter is not set, this defaults to 'all'
To match the original beahviour, user needs to modify:
perf_tool_cpu=0 to perf_tool_cpu=[0]
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
---
.../IperfMeasurementGenerator.py | 26 ++++++++++++++-----
1 file changed, 20 insertions(+), 6 deletions(-)
diff --git a/lnst/Recipes/ENRT/MeasurementGenerators/IperfMeasurementGenerator.py
b/lnst/Recipes/ENRT/MeasurementGenerators/IperfMeasurementGenerator.py
index 5570f9e4..adac62a2 100644
--- a/lnst/Recipes/ENRT/MeasurementGenerators/IperfMeasurementGenerator.py
+++ b/lnst/Recipes/ENRT/MeasurementGenerators/IperfMeasurementGenerator.py
@@ -2,6 +2,7 @@ from lnst.Common.Parameters import (
Param,
IntParam,
ListParam,
+ StrParam,
)
from lnst.Common.IpAddress import AF_INET, AF_INET6
@@ -60,7 +61,8 @@ class IperfMeasurementGenerator(BaseMeasurementGenerator):
# common perf test params
perf_tests = Param(default=("tcp_stream", "udp_stream",
"sctp_stream"))
- perf_tool_cpu = IntParam(mandatory=False)
+ perf_tool_cpu = ListParam(mandatory=False)
+ perf_tool_cpu_policy = StrParam(mandatory=False)
perf_duration = IntParam(default=60)
perf_iterations = IntParam(default=5)
perf_parallel_streams = IntParam(default=1)
@@ -142,11 +144,26 @@ class IperfMeasurementGenerator(BaseMeasurementGenerator):
server_bind,
port_offset + i,
msg_size,
+ self._cpupin_based_on_policy(i),
)
)
return flows
+ def _cpupin_based_on_policy(self, process_no=None):
+ if process_no is None:
+ return None
+
+ # TODO: what if cpu related params are None, return None?
+
+ cpus = self.params.perf_tool_cpu
+ if self.params.perf_tool_cpu_policy == 'round-robin':
+ return [cpus[process_no % len(cpus)]]
+ elif self.params.perf_tool_cpu_policy == 'all':
+ return cpus
+ else:
+ return None
+
def _create_perf_flow(
self,
perf_test,
@@ -156,6 +173,7 @@ class IperfMeasurementGenerator(BaseMeasurementGenerator):
server_bind,
server_port,
msg_size,
+ cpupin,
) -> PerfFlow:
"""
Wrapper to create a PerfFlow. Mixins that want to change this behavior (for
example, to reverse the direction)
@@ -173,9 +191,5 @@ class IperfMeasurementGenerator(BaseMeasurementGenerator):
msg_size=msg_size,
duration=self.params.perf_duration,
parallel_streams=self.params.perf_parallel_streams,
- cpupin=(
- self.params.perf_tool_cpu
- if "perf_tool_cpu" in self.params
- else None
- ),
+ cpupin=cpupin,
)
--
2.26.2