* [PATCH 1/3] perf test: Introduce workloads__for_each()
2024-10-11 14:39 [PATCH 0/3] Document the 'perf test -w' workloads functionality Arnaldo Carvalho de Melo
@ 2024-10-11 14:39 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 10+ messages in thread
From: Arnaldo Carvalho de Melo @ 2024-10-11 14:39 UTC (permalink / raw)
To: Namhyung Kim
Cc: Ingo Molnar, Thomas Gleixner, Jiri Olsa, Ian Rogers,
Adrian Hunter, Kan Liang, Clark Williams, linux-kernel,
linux-perf-users, Arnaldo Carvalho de Melo
From: Arnaldo Carvalho de Melo <acme@redhat.com>
And use it in run_workload().
Testing it:
root@x1:~# perf trace -e *landlock* perf test -w landlock
0.000 ( 0.015 ms): :1274331/1274331 landlock_add_rule(ruleset_fd: 11, rule_type: LANDLOCK_RULE_PATH_BENEATH, rule_attr: 0x7ffd3fea55e0, flags: 45) = -1 EINVAL (Invalid argument)
0.018 ( 0.003 ms): :1274331/1274331 landlock_add_rule(ruleset_fd: 11, rule_type: LANDLOCK_RULE_NET_PORT, rule_attr: 0x7ffd3fea55f0, flags: 45) = -1 EINVAL (Invalid argument)
root@x1:~# perf test -w bla
No workload found: bla
root@x1:~#
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/tests/builtin-test.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c
index 470a9709427ddaad..2201f7ed432ce9f2 100644
--- a/tools/perf/tests/builtin-test.c
+++ b/tools/perf/tests/builtin-test.c
@@ -155,6 +155,9 @@ static struct test_workload *workloads[] = {
&workload__landlock,
};
+#define workloads__for_each(workload) \
+ for (unsigned i = 0; i < ARRAY_SIZE(workloads) && ({ workload = workloads[i]; 1; }); i++)
+
static int num_subtests(const struct test_suite *t)
{
int num;
@@ -504,11 +507,9 @@ static int perf_test__list(int argc, const char **argv)
static int run_workload(const char *work, int argc, const char **argv)
{
- unsigned int i = 0;
struct test_workload *twl;
- for (i = 0; i < ARRAY_SIZE(workloads); i++) {
- twl = workloads[i];
+ workloads__for_each(twl) {
if (!strcmp(twl->name, work))
return twl->func(argc, argv);
}
--
2.47.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 0/3] Document the 'perf test -w' workloads functionality
@ 2024-10-11 17:14 Arnaldo Carvalho de Melo
2024-10-11 17:14 ` [PATCH 1/3] perf test: Introduce workloads__for_each() Arnaldo Carvalho de Melo
` (3 more replies)
0 siblings, 4 replies; 10+ messages in thread
From: Arnaldo Carvalho de Melo @ 2024-10-11 17:14 UTC (permalink / raw)
To: Namhyung Kim
Cc: Ingo Molnar, Thomas Gleixner, Jiri Olsa, Ian Rogers,
Adrian Hunter, Kan Liang, Clark Williams, linux-kernel,
linux-perf-users, Arnaldo Carvalho de Melo, James Clark
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Hi,
I noticed that the 'perf test -w' code wasn't well exposed, so
add a '-w --list' option to list the existing workloads and document it
in the 'perf test' man page.
- Arnaldo
v2:
- Use --list-workloads, as suggesed by James Clark.
- Add info in the man page about the parameters the built-in workloads
accept.
Arnaldo Carvalho de Melo (3):
perf test: Introduce workloads__for_each()
perf test: Introduce '-w --list' to list the available workloads
perf test: Document the -w/--workload option
tools/perf/Documentation/perf-test.txt | 14 +++++++++++++
tools/perf/tests/builtin-test.c | 27 ++++++++++++++++++++++----
2 files changed, 37 insertions(+), 4 deletions(-)
--
2.47.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/3] perf test: Introduce workloads__for_each()
2024-10-11 17:14 [PATCH v2 0/3] Document the 'perf test -w' workloads functionality Arnaldo Carvalho de Melo
@ 2024-10-11 17:14 ` Arnaldo Carvalho de Melo
2024-10-11 17:14 ` [PATCH 2/3] perf test: Introduce '-w --list' to list the available workloads Arnaldo Carvalho de Melo
` (2 subsequent siblings)
3 siblings, 0 replies; 10+ messages in thread
From: Arnaldo Carvalho de Melo @ 2024-10-11 17:14 UTC (permalink / raw)
To: Namhyung Kim
Cc: Ingo Molnar, Thomas Gleixner, Jiri Olsa, Ian Rogers,
Adrian Hunter, Kan Liang, Clark Williams, linux-kernel,
linux-perf-users, Arnaldo Carvalho de Melo, James Clark
From: Arnaldo Carvalho de Melo <acme@redhat.com>
And use it in run_workload().
Testing it:
root@x1:~# perf trace -e *landlock* perf test -w landlock
0.000 ( 0.015 ms): :1274331/1274331 landlock_add_rule(ruleset_fd: 11, rule_type: LANDLOCK_RULE_PATH_BENEATH, rule_attr: 0x7ffd3fea55e0, flags: 45) = -1 EINVAL (Invalid argument)
0.018 ( 0.003 ms): :1274331/1274331 landlock_add_rule(ruleset_fd: 11, rule_type: LANDLOCK_RULE_NET_PORT, rule_attr: 0x7ffd3fea55f0, flags: 45) = -1 EINVAL (Invalid argument)
root@x1:~# perf test -w bla
No workload found: bla
root@x1:~#
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: James Clark <james.clark@linaro.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/tests/builtin-test.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c
index 470a9709427ddaad..2201f7ed432ce9f2 100644
--- a/tools/perf/tests/builtin-test.c
+++ b/tools/perf/tests/builtin-test.c
@@ -155,6 +155,9 @@ static struct test_workload *workloads[] = {
&workload__landlock,
};
+#define workloads__for_each(workload) \
+ for (unsigned i = 0; i < ARRAY_SIZE(workloads) && ({ workload = workloads[i]; 1; }); i++)
+
static int num_subtests(const struct test_suite *t)
{
int num;
@@ -504,11 +507,9 @@ static int perf_test__list(int argc, const char **argv)
static int run_workload(const char *work, int argc, const char **argv)
{
- unsigned int i = 0;
struct test_workload *twl;
- for (i = 0; i < ARRAY_SIZE(workloads); i++) {
- twl = workloads[i];
+ workloads__for_each(twl) {
if (!strcmp(twl->name, work))
return twl->func(argc, argv);
}
--
2.47.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/3] perf test: Introduce '-w --list' to list the available workloads
2024-10-11 17:14 [PATCH v2 0/3] Document the 'perf test -w' workloads functionality Arnaldo Carvalho de Melo
2024-10-11 17:14 ` [PATCH 1/3] perf test: Introduce workloads__for_each() Arnaldo Carvalho de Melo
@ 2024-10-11 17:14 ` Arnaldo Carvalho de Melo
2024-10-17 20:15 ` Namhyung Kim
2024-10-11 17:14 ` [PATCH 3/3] perf test: Document the -w/--workload option Arnaldo Carvalho de Melo
2024-10-14 8:42 ` [PATCH v2 0/3] Document the 'perf test -w' workloads functionality James Clark
3 siblings, 1 reply; 10+ messages in thread
From: Arnaldo Carvalho de Melo @ 2024-10-11 17:14 UTC (permalink / raw)
To: Namhyung Kim
Cc: Ingo Molnar, Thomas Gleixner, Jiri Olsa, Ian Rogers,
Adrian Hunter, Kan Liang, Clark Williams, linux-kernel,
linux-perf-users, Arnaldo Carvalho de Melo, James Clark
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Using it:
$ perf test -w noplop
No workload found: noplop
$
$ perf test -w
Error: switch `w' requires a value
Usage: perf test [<options>] [{list <test-name-fragment>|[<test-name-fragments>|<test-numbers>]}]
-w, --workload <work>
workload to run for testing, use '--list-workloads' to list the available ones.
$
$ perf test --list-workloads
noploop
thloop
leafloop
sqrtloop
brstack
datasym
landlock
$
Would be good at some point to have a description in 'struct test_workload'.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: James Clark <james.clark@linaro.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/tests/builtin-test.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c
index 2201f7ed432ce9f2..cc43b9f366d09436 100644
--- a/tools/perf/tests/builtin-test.c
+++ b/tools/perf/tests/builtin-test.c
@@ -505,6 +505,17 @@ static int perf_test__list(int argc, const char **argv)
return 0;
}
+static int workloads__fprintf_list(FILE *fp)
+{
+ struct test_workload *twl;
+ int printed = 0;
+
+ workloads__for_each(twl)
+ printed += fprintf(fp, "%s\n", twl->name);
+
+ return printed;
+}
+
static int run_workload(const char *work, int argc, const char **argv)
{
struct test_workload *twl;
@@ -535,6 +546,7 @@ int cmd_test(int argc, const char **argv)
};
const char *skip = NULL;
const char *workload = NULL;
+ bool list_workloads = false;
const struct option test_options[] = {
OPT_STRING('s', "skip", &skip, "tests", "tests to skip"),
OPT_INCR('v', "verbose", &verbose,
@@ -544,7 +556,8 @@ int cmd_test(int argc, const char **argv)
OPT_BOOLEAN('p', "parallel", ¶llel, "Run the tests in parallel"),
OPT_BOOLEAN('S', "sequential", &sequential,
"Run the tests one after another rather than in parallel"),
- OPT_STRING('w', "workload", &workload, "work", "workload to run for testing"),
+ OPT_STRING('w', "workload", &workload, "work", "workload to run for testing, use '--list-workloads' to list the available ones."),
+ OPT_BOOLEAN(0, "list-workloads", &list_workloads, "List the available builtin workloads to use with -w/--workload"),
OPT_STRING(0, "dso", &dso_to_test, "dso", "dso to test"),
OPT_STRING(0, "objdump", &test_objdump_path, "path",
"objdump binary to use for disassembly and annotations"),
@@ -570,6 +583,11 @@ int cmd_test(int argc, const char **argv)
if (workload)
return run_workload(workload, argc, argv);
+ if (list_workloads) {
+ workloads__fprintf_list(stdout);
+ return 0;
+ }
+
if (dont_fork)
sequential = true;
else if (parallel)
--
2.47.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/3] perf test: Document the -w/--workload option
2024-10-11 17:14 [PATCH v2 0/3] Document the 'perf test -w' workloads functionality Arnaldo Carvalho de Melo
2024-10-11 17:14 ` [PATCH 1/3] perf test: Introduce workloads__for_each() Arnaldo Carvalho de Melo
2024-10-11 17:14 ` [PATCH 2/3] perf test: Introduce '-w --list' to list the available workloads Arnaldo Carvalho de Melo
@ 2024-10-11 17:14 ` Arnaldo Carvalho de Melo
2024-10-14 8:41 ` James Clark
2024-10-14 8:42 ` [PATCH v2 0/3] Document the 'perf test -w' workloads functionality James Clark
3 siblings, 1 reply; 10+ messages in thread
From: Arnaldo Carvalho de Melo @ 2024-10-11 17:14 UTC (permalink / raw)
To: Namhyung Kim
Cc: Ingo Molnar, Thomas Gleixner, Jiri Olsa, Ian Rogers,
Adrian Hunter, Kan Liang, Clark Williams, linux-kernel,
linux-perf-users, Arnaldo Carvalho de Melo, James Clark
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Wasn't documented so far, mention that it is mostly used in the shell
regression tests.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: James Clark <james.clark@linaro.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/Documentation/perf-test.txt | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/tools/perf/Documentation/perf-test.txt b/tools/perf/Documentation/perf-test.txt
index 9acb8d1f658890e9..62ce705d365f0442 100644
--- a/tools/perf/Documentation/perf-test.txt
+++ b/tools/perf/Documentation/perf-test.txt
@@ -48,3 +48,17 @@ OPTIONS
--dso::
Specify a DSO for the "Symbols" test.
+
+-w::
+--workload=::
+ Run a built-in workload, to list them use '-w --list', current ones include:
+ noploop, thloop, leafloop, sqrtloop, brstack, datasym and landlock.
+
+ Used with the shell script regression tests.
+
+ Some accept an extra parameter:
+
+ seconds: leafloop, noploop, sqrtloop, thloop
+ nrloops: brstack
+
+ The datasym and landlock workloads don't accept any.
--
2.47.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 3/3] perf test: Document the -w/--workload option
2024-10-11 17:14 ` [PATCH 3/3] perf test: Document the -w/--workload option Arnaldo Carvalho de Melo
@ 2024-10-14 8:41 ` James Clark
2024-10-18 12:38 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 10+ messages in thread
From: James Clark @ 2024-10-14 8:41 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Namhyung Kim
Cc: Ingo Molnar, Thomas Gleixner, Jiri Olsa, Ian Rogers,
Adrian Hunter, Kan Liang, Clark Williams, linux-kernel,
linux-perf-users, Arnaldo Carvalho de Melo
On 11/10/2024 6:14 pm, Arnaldo Carvalho de Melo wrote:
> From: Arnaldo Carvalho de Melo <acme@redhat.com>
>
> Wasn't documented so far, mention that it is mostly used in the shell
> regression tests.
>
> Cc: Adrian Hunter <adrian.hunter@intel.com>
> Cc: Ian Rogers <irogers@google.com>
> Cc: James Clark <james.clark@linaro.org>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Cc: Kan Liang <kan.liang@linux.intel.com>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> ---
> tools/perf/Documentation/perf-test.txt | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/tools/perf/Documentation/perf-test.txt b/tools/perf/Documentation/perf-test.txt
> index 9acb8d1f658890e9..62ce705d365f0442 100644
> --- a/tools/perf/Documentation/perf-test.txt
> +++ b/tools/perf/Documentation/perf-test.txt
> @@ -48,3 +48,17 @@ OPTIONS
>
> --dso::
> Specify a DSO for the "Symbols" test.
> +
> +-w::
> +--workload=::
> + Run a built-in workload, to list them use '-w --list', current ones include:
Should be --list-workloads now
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 0/3] Document the 'perf test -w' workloads functionality
2024-10-11 17:14 [PATCH v2 0/3] Document the 'perf test -w' workloads functionality Arnaldo Carvalho de Melo
` (2 preceding siblings ...)
2024-10-11 17:14 ` [PATCH 3/3] perf test: Document the -w/--workload option Arnaldo Carvalho de Melo
@ 2024-10-14 8:42 ` James Clark
3 siblings, 0 replies; 10+ messages in thread
From: James Clark @ 2024-10-14 8:42 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Namhyung Kim
Cc: Ingo Molnar, Thomas Gleixner, Jiri Olsa, Ian Rogers,
Adrian Hunter, Kan Liang, Clark Williams, linux-kernel,
linux-perf-users, Arnaldo Carvalho de Melo
On 11/10/2024 6:14 pm, Arnaldo Carvalho de Melo wrote:
> From: Arnaldo Carvalho de Melo <acme@redhat.com>
>
> Hi,
>
> I noticed that the 'perf test -w' code wasn't well exposed, so
> add a '-w --list' option to list the existing workloads and document it
> in the 'perf test' man page.
>
> - Arnaldo
>
> v2:
>
> - Use --list-workloads, as suggesed by James Clark.
>
> - Add info in the man page about the parameters the built-in workloads
> accept.
>
> Arnaldo Carvalho de Melo (3):
> perf test: Introduce workloads__for_each()
> perf test: Introduce '-w --list' to list the available workloads
> perf test: Document the -w/--workload option
>
> tools/perf/Documentation/perf-test.txt | 14 +++++++++++++
> tools/perf/tests/builtin-test.c | 27 ++++++++++++++++++++++----
> 2 files changed, 37 insertions(+), 4 deletions(-)
>
With the fix for the comment on patch 3:
Reviewed-by: James Clark <james.clark@linaro.org>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/3] perf test: Introduce '-w --list' to list the available workloads
2024-10-11 17:14 ` [PATCH 2/3] perf test: Introduce '-w --list' to list the available workloads Arnaldo Carvalho de Melo
@ 2024-10-17 20:15 ` Namhyung Kim
0 siblings, 0 replies; 10+ messages in thread
From: Namhyung Kim @ 2024-10-17 20:15 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Ingo Molnar, Thomas Gleixner, Jiri Olsa, Ian Rogers,
Adrian Hunter, Kan Liang, Clark Williams, linux-kernel,
linux-perf-users, Arnaldo Carvalho de Melo, James Clark
Hi Arnaldo,
The commit subject line should be changed to --list-workloads too.
Thanks,
Namhyung
On Fri, Oct 11, 2024 at 02:14:48PM -0300, Arnaldo Carvalho de Melo wrote:
> From: Arnaldo Carvalho de Melo <acme@redhat.com>
>
> Using it:
>
> $ perf test -w noplop
> No workload found: noplop
> $
> $ perf test -w
> Error: switch `w' requires a value
> Usage: perf test [<options>] [{list <test-name-fragment>|[<test-name-fragments>|<test-numbers>]}]
>
> -w, --workload <work>
> workload to run for testing, use '--list-workloads' to list the available ones.
> $
> $ perf test --list-workloads
> noploop
> thloop
> leafloop
> sqrtloop
> brstack
> datasym
> landlock
> $
>
> Would be good at some point to have a description in 'struct test_workload'.
>
> Cc: Adrian Hunter <adrian.hunter@intel.com>
> Cc: Ian Rogers <irogers@google.com>
> Cc: James Clark <james.clark@linaro.org>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Cc: Kan Liang <kan.liang@linux.intel.com>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> ---
> tools/perf/tests/builtin-test.c | 20 +++++++++++++++++++-
> 1 file changed, 19 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c
> index 2201f7ed432ce9f2..cc43b9f366d09436 100644
> --- a/tools/perf/tests/builtin-test.c
> +++ b/tools/perf/tests/builtin-test.c
> @@ -505,6 +505,17 @@ static int perf_test__list(int argc, const char **argv)
> return 0;
> }
>
> +static int workloads__fprintf_list(FILE *fp)
> +{
> + struct test_workload *twl;
> + int printed = 0;
> +
> + workloads__for_each(twl)
> + printed += fprintf(fp, "%s\n", twl->name);
> +
> + return printed;
> +}
> +
> static int run_workload(const char *work, int argc, const char **argv)
> {
> struct test_workload *twl;
> @@ -535,6 +546,7 @@ int cmd_test(int argc, const char **argv)
> };
> const char *skip = NULL;
> const char *workload = NULL;
> + bool list_workloads = false;
> const struct option test_options[] = {
> OPT_STRING('s', "skip", &skip, "tests", "tests to skip"),
> OPT_INCR('v', "verbose", &verbose,
> @@ -544,7 +556,8 @@ int cmd_test(int argc, const char **argv)
> OPT_BOOLEAN('p', "parallel", ¶llel, "Run the tests in parallel"),
> OPT_BOOLEAN('S', "sequential", &sequential,
> "Run the tests one after another rather than in parallel"),
> - OPT_STRING('w', "workload", &workload, "work", "workload to run for testing"),
> + OPT_STRING('w', "workload", &workload, "work", "workload to run for testing, use '--list-workloads' to list the available ones."),
> + OPT_BOOLEAN(0, "list-workloads", &list_workloads, "List the available builtin workloads to use with -w/--workload"),
> OPT_STRING(0, "dso", &dso_to_test, "dso", "dso to test"),
> OPT_STRING(0, "objdump", &test_objdump_path, "path",
> "objdump binary to use for disassembly and annotations"),
> @@ -570,6 +583,11 @@ int cmd_test(int argc, const char **argv)
> if (workload)
> return run_workload(workload, argc, argv);
>
> + if (list_workloads) {
> + workloads__fprintf_list(stdout);
> + return 0;
> + }
> +
> if (dont_fork)
> sequential = true;
> else if (parallel)
> --
> 2.47.0
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 3/3] perf test: Document the -w/--workload option
2024-10-14 8:41 ` James Clark
@ 2024-10-18 12:38 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 10+ messages in thread
From: Arnaldo Carvalho de Melo @ 2024-10-18 12:38 UTC (permalink / raw)
To: James Clark
Cc: Namhyung Kim, Ingo Molnar, Thomas Gleixner, Jiri Olsa, Ian Rogers,
Adrian Hunter, Kan Liang, Clark Williams, linux-kernel,
linux-perf-users, Arnaldo Carvalho de Melo
On Mon, Oct 14, 2024 at 09:41:03AM +0100, James Clark wrote:
> On 11/10/2024 6:14 pm, Arnaldo Carvalho de Melo wrote:
> > +++ b/tools/perf/Documentation/perf-test.txt
> > @@ -48,3 +48,17 @@ OPTIONS
> > --dso::
> > Specify a DSO for the "Symbols" test.
> > +
> > +-w::
> > +--workload=::
> > + Run a built-in workload, to list them use '-w --list', current ones include:
>
> Should be --list-workloads now
Oops, fixed now.
Thanks,
- Arnaldo
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/3] perf test: Introduce workloads__for_each()
2024-10-20 2:18 [PATCH 0/3 v3] Expose " Arnaldo Carvalho de Melo
@ 2024-10-20 2:18 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 10+ messages in thread
From: Arnaldo Carvalho de Melo @ 2024-10-20 2:18 UTC (permalink / raw)
To: Namhyung Kim
Cc: Ingo Molnar, Thomas Gleixner, Jiri Olsa, Ian Rogers,
Adrian Hunter, Kan Liang, Clark Williams, linux-kernel,
linux-perf-users, Arnaldo Carvalho de Melo, James Clark
From: Arnaldo Carvalho de Melo <acme@redhat.com>
And use it in run_workload().
Testing it:
root@x1:~# perf trace -e *landlock* perf test -w landlock
0.000 ( 0.015 ms): :1274331/1274331 landlock_add_rule(ruleset_fd: 11, rule_type: LANDLOCK_RULE_PATH_BENEATH, rule_attr: 0x7ffd3fea55e0, flags: 45) = -1 EINVAL (Invalid argument)
0.018 ( 0.003 ms): :1274331/1274331 landlock_add_rule(ruleset_fd: 11, rule_type: LANDLOCK_RULE_NET_PORT, rule_attr: 0x7ffd3fea55f0, flags: 45) = -1 EINVAL (Invalid argument)
root@x1:~# perf test -w bla
No workload found: bla
root@x1:~#
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: James Clark <james.clark@linaro.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/lkml/20241011171449.1362979-2-acme@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/tests/builtin-test.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c
index 470a9709427ddaad..2201f7ed432ce9f2 100644
--- a/tools/perf/tests/builtin-test.c
+++ b/tools/perf/tests/builtin-test.c
@@ -155,6 +155,9 @@ static struct test_workload *workloads[] = {
&workload__landlock,
};
+#define workloads__for_each(workload) \
+ for (unsigned i = 0; i < ARRAY_SIZE(workloads) && ({ workload = workloads[i]; 1; }); i++)
+
static int num_subtests(const struct test_suite *t)
{
int num;
@@ -504,11 +507,9 @@ static int perf_test__list(int argc, const char **argv)
static int run_workload(const char *work, int argc, const char **argv)
{
- unsigned int i = 0;
struct test_workload *twl;
- for (i = 0; i < ARRAY_SIZE(workloads); i++) {
- twl = workloads[i];
+ workloads__for_each(twl) {
if (!strcmp(twl->name, work))
return twl->func(argc, argv);
}
--
2.46.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
end of thread, other threads:[~2024-10-20 2:18 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-11 17:14 [PATCH v2 0/3] Document the 'perf test -w' workloads functionality Arnaldo Carvalho de Melo
2024-10-11 17:14 ` [PATCH 1/3] perf test: Introduce workloads__for_each() Arnaldo Carvalho de Melo
2024-10-11 17:14 ` [PATCH 2/3] perf test: Introduce '-w --list' to list the available workloads Arnaldo Carvalho de Melo
2024-10-17 20:15 ` Namhyung Kim
2024-10-11 17:14 ` [PATCH 3/3] perf test: Document the -w/--workload option Arnaldo Carvalho de Melo
2024-10-14 8:41 ` James Clark
2024-10-18 12:38 ` Arnaldo Carvalho de Melo
2024-10-14 8:42 ` [PATCH v2 0/3] Document the 'perf test -w' workloads functionality James Clark
-- strict thread matches above, loose matches on Subject: below --
2024-10-20 2:18 [PATCH 0/3 v3] Expose " Arnaldo Carvalho de Melo
2024-10-20 2:18 ` [PATCH 1/3] perf test: Introduce workloads__for_each() Arnaldo Carvalho de Melo
2024-10-11 14:39 [PATCH 0/3] Document the 'perf test -w' workloads functionality Arnaldo Carvalho de Melo
2024-10-11 14:39 ` [PATCH 1/3] perf test: Introduce workloads__for_each() Arnaldo Carvalho de Melo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).