From 5126eba1b4d60d259db4c5f67dc15049817d95d7 Mon Sep 17 00:00:00 2001 From: Quentin Perret Date: Thu, 16 May 2019 14:10:47 +0100 Subject: [PATCH] wlgen: sysbench: Expose --num-threads It is possible to specify the number of threads of sysbench using a command line option. As this is often useful, expose it as an argument of the run method(), like --max-time for example. Signed-off-by: Quentin Perret --- lisa/wlgen/sysbench.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lisa/wlgen/sysbench.py b/lisa/wlgen/sysbench.py index e169d92b3..620fed338 100644 --- a/lisa/wlgen/sysbench.py +++ b/lisa/wlgen/sysbench.py @@ -61,7 +61,8 @@ class Sysbench(Workload): def run(self, cpus=None, cgroup=None, background=False, as_root=False, - test="cpu", max_duration_s=None, max_requests=None, **kwargs): + test="cpu", max_duration_s=None, max_requests=None, + num_threads=None, **kwargs): """ Execute the workload on the configured target. @@ -86,6 +87,9 @@ class Sysbench(Workload): :param: max_requests: Maximum number of event requests :type max_requests: int + :param: num_threads: Number of threads + :type num_threads: int + :Keyword arguments: Additionnal arguments required by the specific test (run ``sysbench --test= help``). Due to Python limitations, use ``_`` instead of ``-`` for argument naming. @@ -100,6 +104,9 @@ class Sysbench(Workload): if max_requests is not None: command = "{} --max-requests={}".format(command, max_requests) + if num_threads is not None: + command = "{} --num-threads={}".format(command, num_threads) + extra_args = " ".join(["--{}={}".format(arg.replace("_", "-"), value) for arg, value in list(kwargs.items())]) if extra_args: -- GitLab