mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-02-16 20:05:13 -05:00
perf test: Add timeout to datasym workload
Unlike others it has an infinite loop that make it annoying to call. Make it finish after 1 second and handle command-line argument to change the setting. Reviewed-by: Leo Yan <leo.yan@arm.com> Tested-by: Thomas Richter <tmricht@linux.ibm.com> Tested-by: Thomas Falcon <thomas.falcon@intel.com> Cc: Thomas Richter <tmricht@linux.ibm.com> Cc: Leo Yan <leo.yan@arm.com> Link: https://lore.kernel.org/r/20250304022837.1877845-6-namhyung@kernel.org Signed-off-by: Namhyung Kim <namhyung@kernel.org>
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
#include <linux/compiler.h>
|
||||
#include "../tests.h"
|
||||
|
||||
@@ -12,9 +15,25 @@ static buf buf1 = {
|
||||
.reserved[0] = 1,
|
||||
};
|
||||
|
||||
static int datasym(int argc __maybe_unused, const char **argv __maybe_unused)
|
||||
static volatile sig_atomic_t done;
|
||||
|
||||
static void sighandler(int sig __maybe_unused)
|
||||
{
|
||||
for (;;) {
|
||||
done = 1;
|
||||
}
|
||||
|
||||
static int datasym(int argc, const char **argv)
|
||||
{
|
||||
int sec = 1;
|
||||
|
||||
if (argc > 0)
|
||||
sec = atoi(argv[0]);
|
||||
|
||||
signal(SIGINT, sighandler);
|
||||
signal(SIGALRM, sighandler);
|
||||
alarm(sec);
|
||||
|
||||
while (!done) {
|
||||
buf1.data1++;
|
||||
if (buf1.data1 == 123) {
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user