----- Original Message -----
From: "Ondrej Lichtner" <olichtne(a)redhat.com>
To: csfakian(a)redhat.com
Cc: lnst-developers(a)lists.fedorahosted.org
Sent: Wednesday, February 27, 2019 12:02:10 PM
Subject: Re: [PATCH-next 1/2] lnst.Recipes.ENRT: edit BaseEnrtRecipe
On Fri, Feb 22, 2019 at 05:39:23PM +0100, csfakian(a)redhat.com wrote:
> From: Christos Sfakianakis <csfakian(a)redhat.com>
>
> Add 'perf_reverse' parameter to handle from-both-sides
> perf scenarios (used in 8 of the old phase 2 recipes).
>
> Signed-off-by: Christos Sfakianakis <csfakian(a)redhat.com>
> ---
> lnst/Recipes/ENRT/BaseEnrtRecipe.py | 44 ++++++++++++++++-------------
> 1 file changed, 25 insertions(+), 19 deletions(-)
>
> diff --git a/lnst/Recipes/ENRT/BaseEnrtRecipe.py
> b/lnst/Recipes/ENRT/BaseEnrtRecipe.py
> index 84a382c..125b209 100644
> --- a/lnst/Recipes/ENRT/BaseEnrtRecipe.py
> +++ b/lnst/Recipes/ENRT/BaseEnrtRecipe.py
> @@ -83,6 +83,7 @@ class BaseEnrtRecipe(PingTestAndEvaluate, PerfRecipe):
> perf_duration = IntParam(default=60)
> perf_iterations = IntParam(default=5)
> perf_parallel_streams = IntParam(default=1)
> + perf_reverse = BoolParam(default=False)
> perf_msg_size = IntParam(default=123)
>
> perf_usr_comment = StrParam(default="")
> @@ -192,26 +193,31 @@ class BaseEnrtRecipe(PingTestAndEvaluate,
> PerfRecipe):
> client_bind = client_nic.ips_filter(family=family)[0]
> server_bind = server_nic.ips_filter(family=family)[0]
>
> + flow_ends = [(client_netns, client_bind, server_netns,
> server_bind)]
> + if self.params.perf_reverse:
> + flow_ends += [(server_netns, server_bind, client_netns,
> client_bind)]
I think a better option would be to create a "reverse_flow" help method
that will accept a PerfFlow object as input and return a new PerfFlow
object that has the generator and receivers reversed. Then I'd move the
"if self.params.perf_reverse" condition down into the loop after the
first "yield" and just do:
if self.params.perf_reverse:
reverse_flow(flow)
yield ReversedPerfConf(...)
This could also help with the unclear naming of the flow_ends etc...
Adding a
helper method and making the code clearer.
-Christos
>
> > +
> > for perf_test in self.params.perf_tests:
> > - flow = PerfFlow(
> > - type = perf_test,
> > - generator = client_netns,
> > - generator_bind = client_bind,
> > - receiver = server_netns,
> > - receiver_bind = server_bind,
> > - msg_size = self.params.perf_msg_size,
> > - duration = self.params.perf_duration,
> > - parallel_streams =
> > self.params.perf_parallel_streams,
> > - cpupin = self.params.perf_intr_cpu
> > - )
> > -
> > - flow_measurement = self.params.net_perf_tool([flow])
> > - yield PerfRecipeConf(
> > - measurements=[
> > - self.params.cpu_perf_tool([client_netns,
> > server_netns]),
> > - flow_measurement
> > - ],
> > - iterations=self.params.perf_iterations)
> > + for client_ns, client_ip, server_ns, server_ip in
> > flow_ends:
> > + flow = PerfFlow(
> > + type = perf_test,
> > + generator = client_ns,
> > + generator_bind = client_ip,
> > + receiver = server_ns,
> > + receiver_bind = server_ip,
> > + msg_size = self.params.perf_msg_size,
> > + duration = self.params.perf_duration,
> > + parallel_streams =
> > self.params.perf_parallel_streams,
> > + cpupin = self.params.perf_intr_cpu
> > + )
> > +
> > + flow_measurement = self.params.net_perf_tool([flow])
> > + yield PerfRecipeConf(
> > + measurements=[
> > + self.params.cpu_perf_tool([client_ns,
> > server_ns]),
> > + flow_measurement
> > + ],
> > + iterations=self.params.perf_iterations)
> >
> > def _pin_dev_interrupts(self, dev, cpu):
> > netns = dev.netns
> > --
> > 2.17.1
> > _______________________________________________
> > 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://getfedora.org/code-of-conduct.html
> > List Guidelines:
https://fedoraproject.org/wiki/Mailing_list_guidelines
> > List Archives:
> >
https://lists.fedorahosted.org/archives/list/lnst-developers@lists.fedora...
> _______________________________________________
> 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://getfedora.org/code-of-conduct.html
> List Guidelines:
https://fedoraproject.org/wiki/Mailing_list_guidelines
> List Archives:
>
https://lists.fedorahosted.org/archives/list/lnst-developers@lists.fedora...
>