accel/ivpu: Move recovery work to system_unbound_wq
[drm/drm-misc.git] / tools / perf / tests / workloads / leafloop.c
blobf7561767e32cd284682fb15511a6212d58b3556e
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #include <signal.h>
3 #include <stdlib.h>
4 #include <linux/compiler.h>
5 #include <unistd.h>
6 #include "../tests.h"
8 /* We want to check these symbols in perf script */
9 noinline void leaf(volatile int b);
10 noinline void parent(volatile int b);
12 static volatile int a;
13 static volatile sig_atomic_t done;
15 static void sighandler(int sig __maybe_unused)
17 done = 1;
20 noinline void leaf(volatile int b)
22 while (!done)
23 a += b;
26 noinline void parent(volatile int b)
28 leaf(b);
31 static int leafloop(int argc, const char **argv)
33 int sec = 1;
35 if (argc > 0)
36 sec = atoi(argv[0]);
38 signal(SIGINT, sighandler);
39 signal(SIGALRM, sighandler);
40 alarm(sec);
42 parent(sec);
43 return 0;
46 DEFINE_WORKLOAD(leafloop);