aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/tests/workloads/leafloop.c
diff options
context:
space:
mode:
authorJames Clark <james.clark@arm.com>2024-06-12 15:03:14 +0100
committerNamhyung Kim <namhyung@kernel.org>2024-06-24 14:42:59 -0700
commitff16aeb9b83441b8458d4235496cf320189a0c60 (patch)
treeb5a84f5ad90c5c50601f756afc298876b11af6fc /tools/perf/tests/workloads/leafloop.c
parentperf build: Ensure libtraceevent and libtracefs versions have 3 components (diff)
downloadlinux-ff16aeb9b83441b8458d4235496cf320189a0c60.tar.gz
linux-ff16aeb9b83441b8458d4235496cf320189a0c60.zip
perf test: Make test_arm_callgraph_fp.sh more robust
The 2 second sleep can cause the test to fail on very slow network file systems because Perf ends up being killed before it finishes starting up. Fix it by making the leafloop workload end after a fixed time like the other workloads so there is no need to kill it after 2 seconds. Also remove the 1 second start sampling delay because it is similarly fragile. Instead, search through all samples for a matching one, rather than just checking the first sample and hoping it's in the right place. Fixes: cd6382d82752 ("perf test arm64: Test unwinding using fame-pointer (fp) mode") Signed-off-by: James Clark <james.clark@arm.com> Acked-by: Namhyung Kim <namhyung@kernel.org> Cc: German Gomez <german.gomez@arm.com> Cc: Spoorthy S <spoorts2@in.ibm.com> Cc: Kajol Jain <kjain@linux.ibm.com> Signed-off-by: Namhyung Kim <namhyung@kernel.org> Link: https://lore.kernel.org/r/20240612140316.3006660-1-james.clark@arm.com
Diffstat (limited to 'tools/perf/tests/workloads/leafloop.c')
-rw-r--r--tools/perf/tests/workloads/leafloop.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/tools/perf/tests/workloads/leafloop.c b/tools/perf/tests/workloads/leafloop.c
index 1bf5cc97649b..f7561767e32c 100644
--- a/tools/perf/tests/workloads/leafloop.c
+++ b/tools/perf/tests/workloads/leafloop.c
@@ -1,6 +1,8 @@
/* SPDX-License-Identifier: GPL-2.0 */
+#include <signal.h>
#include <stdlib.h>
#include <linux/compiler.h>
+#include <unistd.h>
#include "../tests.h"
/* We want to check these symbols in perf script */
@@ -8,10 +10,16 @@ noinline void leaf(volatile int b);
noinline void parent(volatile int b);
static volatile int a;
+static volatile sig_atomic_t done;
+
+static void sighandler(int sig __maybe_unused)
+{
+ done = 1;
+}
noinline void leaf(volatile int b)
{
- for (;;)
+ while (!done)
a += b;
}
@@ -22,12 +30,16 @@ noinline void parent(volatile int b)
static int leafloop(int argc, const char **argv)
{
- int c = 1;
+ int sec = 1;
if (argc > 0)
- c = atoi(argv[0]);
+ sec = atoi(argv[0]);
+
+ signal(SIGINT, sighandler);
+ signal(SIGALRM, sighandler);
+ alarm(sec);
- parent(c);
+ parent(sec);
return 0;
}