lkml.org 
[lkml]   [2022]   [Nov]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH 05/12] perf test: Add 'leafloop' test workload
Em Wed, Nov 16, 2022 at 03:38:47PM -0800, Namhyung Kim escreveu:
> 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

On fedora:36

In file included from /usr/include/bits/libc-header-start.h:33,
from /usr/include/stdlib.h:26,
from tests/workloads/leafloop.c:2:
/usr/include/features.h:412:4: error: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Werror=cpp]
412 | # warning _FORTIFY_SOURCE requires compiling with optimization (-O)
| ^~~~~~~
cc1: all warnings being treated as errors
make[5]: *** [/home/acme/git/perf/tools/build/Makefile.build:96: /tmp/build/perf/tests/workloads/leafloop.o] Error 1
make[5]: *** Waiting for unfinished jobs....

I'll try removing the _FORTIFY_SOURCE

> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
> tools/perf/tests/builtin-test.c | 1 +
> tools/perf/tests/tests.h | 1 +
> tools/perf/tests/workloads/Build | 3 +++
> tools/perf/tests/workloads/leafloop.c | 34 +++++++++++++++++++++++++++
> 4 files changed, 39 insertions(+)
> create mode 100644 tools/perf/tests/workloads/leafloop.c
>
> diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c
> index 161f38476e77..0ed5ac452f6e 100644
> --- a/tools/perf/tests/builtin-test.c
> +++ b/tools/perf/tests/builtin-test.c
> @@ -121,6 +121,7 @@ static struct test_suite **tests[] = {
> static struct test_workload *workloads[] = {
> &workload__noploop,
> &workload__thloop,
> + &workload__leafloop,
> };
>
> static int num_subtests(const struct test_suite *t)
> diff --git a/tools/perf/tests/tests.h b/tools/perf/tests/tests.h
> index e6edfeeadaeb..86804dd6452b 100644
> --- a/tools/perf/tests/tests.h
> +++ b/tools/perf/tests/tests.h
> @@ -202,5 +202,6 @@ struct test_workload workload__##work = { \
> /* The list of test workloads */
> DECLARE_WORKLOAD(noploop);
> DECLARE_WORKLOAD(thloop);
> +DECLARE_WORKLOAD(leafloop);
>
> #endif /* TESTS_H */
> diff --git a/tools/perf/tests/workloads/Build b/tools/perf/tests/workloads/Build
> index b8964b1099c0..631596bdb2b3 100644
> --- a/tools/perf/tests/workloads/Build
> +++ b/tools/perf/tests/workloads/Build
> @@ -2,3 +2,6 @@
>
> perf-y += noploop.o
> perf-y += thloop.o
> +perf-y += leafloop.o
> +
> +CFLAGS_leafloop.o = -g -O0 -fno-inline -fno-omit-frame-pointer
> diff --git a/tools/perf/tests/workloads/leafloop.c b/tools/perf/tests/workloads/leafloop.c
> new file mode 100644
> index 000000000000..1bf5cc97649b
> --- /dev/null
> +++ b/tools/perf/tests/workloads/leafloop.c
> @@ -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);
> --
> 2.38.1.584.g0f3c55d4c2-goog
--

- Arnaldo

\
 
 \ /
  Last update: 2022-11-17 17:08    [W:0.125 / U:0.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site