f215054d74
The -w/--workload option is to run a simple workload used by testing. This adds a basic framework to run the workloads and 'noploop' workload as an example. $ perf test -w noploop The noploop does a loop doing nothing (NOP) for a second by default. It can have an optional argument to specify the time in seconds. Signed-off-by: Namhyung Kim <namhyung@kernel.org> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com> Cc: German Gomez <german.gomez@arm.com> Cc: Ian Rogers <irogers@google.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: James Clark <james.clark@arm.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Leo Yan <leo.yan@linaro.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Zhengjun Xing <zhengjun.xing@linux.intel.com> Link: https://lore.kernel.org/r/20221116233854.1596378-2-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
33 lines
494 B
C
33 lines
494 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#include <stdlib.h>
|
|
#include <signal.h>
|
|
#include <unistd.h>
|
|
#include <linux/compiler.h>
|
|
#include "../tests.h"
|
|
|
|
static volatile sig_atomic_t done;
|
|
|
|
static void sighandler(int sig __maybe_unused)
|
|
{
|
|
done = 1;
|
|
}
|
|
|
|
static int noploop(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)
|
|
continue;
|
|
|
|
return 0;
|
|
}
|
|
|
|
DEFINE_WORKLOAD(noploop);
|