mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
perf test: Add 'leafloop' test workload
[ Upstream commit 41522f7442 ]
The leafloop workload is to run an infinite loop in the test_leaf
function. This is needed for the ARM fp callgraph test to verify if it
gets the correct callchains.
$ perf test -w leafloop
Committer notes:
Add a:
-U_FORTIFY_SOURCE
to the leafloop CFLAGS as the main perf flags set it and it requires
building with optimization, and this new test has a -O0.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
Cc: German Gomez <german.gomez@arm.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: James Clark <james.clark@arm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Zhengjun Xing <zhengjun.xing@linux.intel.com>
Link: https://lore.kernel.org/r/20221116233854.1596378-6-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Stable-dep-of: 256ef072b384 ("perf tests: Make "test data symbol" more robust on Neoverse N1")
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
ee9d68456c
commit
a80152003a
@@ -121,6 +121,7 @@ static struct test_suite **tests[] = {
|
|||||||
static struct test_workload *workloads[] = {
|
static struct test_workload *workloads[] = {
|
||||||
&workload__noploop,
|
&workload__noploop,
|
||||||
&workload__thloop,
|
&workload__thloop,
|
||||||
|
&workload__leafloop,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int num_subtests(const struct test_suite *t)
|
static int num_subtests(const struct test_suite *t)
|
||||||
|
|||||||
@@ -202,5 +202,6 @@ struct test_workload workload__##work = { \
|
|||||||
/* The list of test workloads */
|
/* The list of test workloads */
|
||||||
DECLARE_WORKLOAD(noploop);
|
DECLARE_WORKLOAD(noploop);
|
||||||
DECLARE_WORKLOAD(thloop);
|
DECLARE_WORKLOAD(thloop);
|
||||||
|
DECLARE_WORKLOAD(leafloop);
|
||||||
|
|
||||||
#endif /* TESTS_H */
|
#endif /* TESTS_H */
|
||||||
|
|||||||
@@ -2,3 +2,6 @@
|
|||||||
|
|
||||||
perf-y += noploop.o
|
perf-y += noploop.o
|
||||||
perf-y += thloop.o
|
perf-y += thloop.o
|
||||||
|
perf-y += leafloop.o
|
||||||
|
|
||||||
|
CFLAGS_leafloop.o = -g -O0 -fno-inline -fno-omit-frame-pointer -U_FORTIFY_SOURCE
|
||||||
|
|||||||
34
tools/perf/tests/workloads/leafloop.c
Normal file
34
tools/perf/tests/workloads/leafloop.c
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
/* SPDX-License-Identifier: GPL-2.0 */
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <linux/compiler.h>
|
||||||
|
#include "../tests.h"
|
||||||
|
|
||||||
|
/* We want to check these symbols in perf script */
|
||||||
|
noinline void leaf(volatile int b);
|
||||||
|
noinline void parent(volatile int b);
|
||||||
|
|
||||||
|
static volatile int a;
|
||||||
|
|
||||||
|
noinline void leaf(volatile int b)
|
||||||
|
{
|
||||||
|
for (;;)
|
||||||
|
a += b;
|
||||||
|
}
|
||||||
|
|
||||||
|
noinline void parent(volatile int b)
|
||||||
|
{
|
||||||
|
leaf(b);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int leafloop(int argc, const char **argv)
|
||||||
|
{
|
||||||
|
int c = 1;
|
||||||
|
|
||||||
|
if (argc > 0)
|
||||||
|
c = atoi(argv[0]);
|
||||||
|
|
||||||
|
parent(c);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_WORKLOAD(leafloop);
|
||||||
Reference in New Issue
Block a user