1/* SPDX-License-Identifier: GPL-2.0 */
2#include <stdlib.h>
3#include <signal.h>
4#include <unistd.h>
5#include <linux/compiler.h>
6#include "../tests.h"
7
8static volatile sig_atomic_t done;
9
10static void sighandler(int sig __maybe_unused)
11{
12 done = 1;
13}
14
15static int noploop(int argc, const char **argv)
16{
17 int sec = 1;
18
19 if (argc > 0)
20 sec = atoi(argv[0]);
21
22 signal(SIGINT, sighandler);
23 signal(SIGALRM, sighandler);
24 alarm(sec);
25
26 while (!done)
27 continue;
28
29 return 0;
30}
31
32DEFINE_WORKLOAD(noploop);
33

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