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