1/* SPDX-License-Identifier: GPL-2.0 */
2#include <stdlib.h>
3#include <linux/compiler.h>
4#include "../tests.h"
5
6/* We want to check these symbols in perf script */
7noinline void leaf(volatile int b);
8noinline void parent(volatile int b);
9
10static volatile int a;
11
12noinline void leaf(volatile int b)
13{
14 for (;;)
15 a += b;
16}
17
18noinline void parent(volatile int b)
19{
20 leaf(b);
21}
22
23static int leafloop(int argc, const char **argv)
24{
25 int c = 1;
26
27 if (argc > 0)
28 c = atoi(argv[0]);
29
30 parent(b: c);
31 return 0;
32}
33
34DEFINE_WORKLOAD(leafloop);
35

source code of linux/tools/perf/tests/workloads/leafloop.c