mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 09:36:22 +02:00
perf test: Add deterministic workload
Add a workload that does the same thing every time for testing CPU trace decoding. Reviewed-by: Leo Yan <leo.yan@arm.com> Signed-off-by: James Clark <james.clark@linaro.org> Cc: Amir Ayupov <aaupov@meta.com> Cc: Ian Rogers <irogers@google.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Mike Leach <mike.leach@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paschalis Mpeis <Paschalis.Mpeis@arm.com> Cc: Shuah Khan <skhan@linuxfoundation.org> Cc: Suzuki Poulouse <suzuki.poulose@arm.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
be7ef892f3
commit
3fdf30607e
|
|
@ -57,7 +57,7 @@ OPTIONS
|
|||
--workload=::
|
||||
Run a built-in workload, to list them use '--list-workloads', current
|
||||
ones include: noploop, thloop, leafloop, sqrtloop, brstack, datasym,
|
||||
context_switch_loop and landlock.
|
||||
context_switch_loop, deterministic and landlock.
|
||||
|
||||
Used with the shell script regression tests.
|
||||
|
||||
|
|
@ -66,7 +66,7 @@ OPTIONS
|
|||
seconds: leafloop, noploop, sqrtloop, thloop
|
||||
nrloops: brstack, context_switch_loop
|
||||
|
||||
The datasym and landlock workloads don't accept any.
|
||||
The datasym, landlock and deterministic workloads don't accept any.
|
||||
|
||||
--list-workloads::
|
||||
List the available workloads to use with -w/--workload.
|
||||
|
|
|
|||
|
|
@ -164,6 +164,7 @@ static struct test_workload *workloads[] = {
|
|||
&workload__inlineloop,
|
||||
&workload__jitdump,
|
||||
&workload__context_switch_loop,
|
||||
&workload__deterministic,
|
||||
|
||||
#ifdef HAVE_RUST_SUPPORT
|
||||
&workload__code_with_type,
|
||||
|
|
|
|||
|
|
@ -246,6 +246,7 @@ DECLARE_WORKLOAD(traploop);
|
|||
DECLARE_WORKLOAD(inlineloop);
|
||||
DECLARE_WORKLOAD(jitdump);
|
||||
DECLARE_WORKLOAD(context_switch_loop);
|
||||
DECLARE_WORKLOAD(deterministic);
|
||||
|
||||
#ifdef HAVE_RUST_SUPPORT
|
||||
DECLARE_WORKLOAD(code_with_type);
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ perf-test-y += traploop.o
|
|||
perf-test-y += inlineloop.o
|
||||
perf-test-y += jitdump.o
|
||||
perf-test-y += context_switch_loop.o
|
||||
perf-test-y += deterministic.o
|
||||
|
||||
ifeq ($(CONFIG_RUST_SUPPORT),y)
|
||||
perf-test-y += code_with_type.o
|
||||
|
|
@ -23,3 +24,4 @@ CFLAGS_brstack.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE
|
|||
CFLAGS_datasym.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE
|
||||
CFLAGS_traploop.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE
|
||||
CFLAGS_inlineloop.o = -g -O2
|
||||
CFLAGS_deterministic.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE
|
||||
|
|
|
|||
39
tools/perf/tests/workloads/deterministic.c
Normal file
39
tools/perf/tests/workloads/deterministic.c
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
#include <linux/compiler.h>
|
||||
#include "../tests.h"
|
||||
|
||||
int dt_work = 1234;
|
||||
|
||||
static void function1(void)
|
||||
{
|
||||
dt_work += 7;
|
||||
dt_work += 7;
|
||||
dt_work += 7;
|
||||
}
|
||||
|
||||
static void function2(void)
|
||||
{
|
||||
dt_work += 7;
|
||||
dt_work += 7;
|
||||
dt_work += 7;
|
||||
}
|
||||
|
||||
static int deterministic(int argc __maybe_unused,
|
||||
const char **argv __maybe_unused)
|
||||
{
|
||||
dt_work += 7;
|
||||
dt_work += 7;
|
||||
dt_work += 7;
|
||||
|
||||
function1();
|
||||
|
||||
dt_work += 7;
|
||||
dt_work += 7;
|
||||
dt_work += 7;
|
||||
|
||||
function2();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_WORKLOAD(deterministic);
|
||||
Loading…
Reference in New Issue
Block a user