Commit 4cef0e7a authored by Ian Rogers's avatar Ian Rogers Committed by Arnaldo Carvalho de Melo

perf tests: Run tests in parallel by default

Switch from running tests sequentially to running in parallel by
default. Change the opt-in '-p' or '--parallel' flag to '-S' or
'--sequential'.

On an 8 core tigerlake an address sanitizer run time changes from:

  326.54user 622.73system 6:59.91elapsed 226%CPU

to:

  973.02user 583.98system 3:01.17elapsed 859%CPU

So over twice as fast, saving 4 minutes.
Signed-off-by: default avatarIan Rogers <irogers@google.com>
Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@arm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20240301174711.2646944-1-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 7aea01ea
...@@ -39,8 +39,8 @@ ...@@ -39,8 +39,8 @@
* making them easier to debug. * making them easier to debug.
*/ */
static bool dont_fork; static bool dont_fork;
/* Fork the tests in parallel and then wait for their completion. */ /* Don't fork the tests in parallel and wait for their completion. */
static bool parallel; static bool sequential;
const char *dso_to_test; const char *dso_to_test;
const char *test_objdump_path = "objdump"; const char *test_objdump_path = "objdump";
...@@ -374,7 +374,7 @@ static int start_test(struct test_suite *test, int i, int subi, struct child_tes ...@@ -374,7 +374,7 @@ static int start_test(struct test_suite *test, int i, int subi, struct child_tes
} }
(*child)->process.no_exec_cmd = run_test_child; (*child)->process.no_exec_cmd = run_test_child;
err = start_command(&(*child)->process); err = start_command(&(*child)->process);
if (err || parallel) if (err || !sequential)
return err; return err;
return finish_test(*child, width); return finish_test(*child, width);
} }
...@@ -440,7 +440,7 @@ static int __cmd_test(int argc, const char *argv[], struct intlist *skiplist) ...@@ -440,7 +440,7 @@ static int __cmd_test(int argc, const char *argv[], struct intlist *skiplist)
int err = start_test(t, curr, -1, &child_tests[child_test_num++], width); int err = start_test(t, curr, -1, &child_tests[child_test_num++], width);
if (err) { if (err) {
/* TODO: if parallel waitpid the already forked children. */ /* TODO: if !sequential waitpid the already forked children. */
free(child_tests); free(child_tests);
return err; return err;
} }
...@@ -460,7 +460,7 @@ static int __cmd_test(int argc, const char *argv[], struct intlist *skiplist) ...@@ -460,7 +460,7 @@ static int __cmd_test(int argc, const char *argv[], struct intlist *skiplist)
} }
} }
for (i = 0; i < child_test_num; i++) { for (i = 0; i < child_test_num; i++) {
if (parallel) { if (!sequential) {
int ret = finish_test(child_tests[i], width); int ret = finish_test(child_tests[i], width);
if (ret) if (ret)
...@@ -536,8 +536,8 @@ int cmd_test(int argc, const char **argv) ...@@ -536,8 +536,8 @@ int cmd_test(int argc, const char **argv)
"be more verbose (show symbol address, etc)"), "be more verbose (show symbol address, etc)"),
OPT_BOOLEAN('F', "dont-fork", &dont_fork, OPT_BOOLEAN('F', "dont-fork", &dont_fork,
"Do not fork for testcase"), "Do not fork for testcase"),
OPT_BOOLEAN('p', "parallel", &parallel, OPT_BOOLEAN('S', "sequential", &sequential,
"Run the tests altogether in parallel"), "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"),
OPT_STRING(0, "dso", &dso_to_test, "dso", "dso to test"), OPT_STRING(0, "dso", &dso_to_test, "dso", "dso to test"),
OPT_STRING(0, "objdump", &test_objdump_path, "path", OPT_STRING(0, "objdump", &test_objdump_path, "path",
...@@ -564,6 +564,9 @@ int cmd_test(int argc, const char **argv) ...@@ -564,6 +564,9 @@ int cmd_test(int argc, const char **argv)
if (workload) if (workload)
return run_workload(workload, argc, argv); return run_workload(workload, argc, argv);
if (dont_fork)
sequential = true;
symbol_conf.priv_size = sizeof(int); symbol_conf.priv_size = sizeof(int);
symbol_conf.try_vmlinux_path = true; symbol_conf.try_vmlinux_path = true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment