mirror of
https://github.com/torvalds/linux.git
synced 2026-11-27 17:02:17 +00:00
The leafloop workload is to run an infinite loop in the test_leaf function. This is needed for the ARM fp callgraph test to verify if it gets the correct callchains. $ perf test -w leafloop Committer notes: Add a: -U_FORTIFY_SOURCE to the leafloop CFLAGS as the main perf flags set it and it requires building with optimization, and this new test has a -O0. Signed-off-by: Namhyung Kim <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Athira Jajeev <[email protected]> Cc: German Gomez <[email protected]> Cc: Ian Rogers <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: James Clark <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Leo Yan <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Zhengjun Xing <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
35 lines
527 B
C
35 lines
527 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#include <stdlib.h>
|
|
#include <linux/compiler.h>
|
|
#include "../tests.h"
|
|
|
|
/* We want to check these symbols in perf script */
|
|
noinline void leaf(volatile int b);
|
|
noinline void parent(volatile int b);
|
|
|
|
static volatile int a;
|
|
|
|
noinline void leaf(volatile int b)
|
|
{
|
|
for (;;)
|
|
a += b;
|
|
}
|
|
|
|
noinline void parent(volatile int b)
|
|
{
|
|
leaf(b);
|
|
}
|
|
|
|
static int leafloop(int argc, const char **argv)
|
|
{
|
|
int c = 1;
|
|
|
|
if (argc > 0)
|
|
c = atoi(argv[0]);
|
|
|
|
parent(c);
|
|
return 0;
|
|
}
|
|
|
|
DEFINE_WORKLOAD(leafloop);
|