From: Ian Rogers <irogers@google.com>
To: Tony Jones <tonyj@suse.de>, Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
Adrian Hunter <adrian.hunter@intel.com>,
James Clark <james.clark@linaro.org>,
Howard Chu <howardchu95@gmail.com>,
Stephen Brennan <stephen.s.brennan@oracle.com>,
linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org
Subject: [PATCH v3 6/7] perf test workload: Add inlineloop test workload
Date: Sat, 10 Jan 2026 20:13:37 -0800 [thread overview]
Message-ID: <20260111041338.1817056-7-irogers@google.com> (raw)
In-Reply-To: <20260111041338.1817056-1-irogers@google.com>
The purpose of this workload is to gather samples in an inlined
function. This can be used to test whether inlined addr2line works
correctly.
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/tests/builtin-test.c | 1 +
tools/perf/tests/tests.h | 1 +
tools/perf/tests/workloads/Build | 2 +
tools/perf/tests/workloads/inlineloop.c | 52 +++++++++++++++++++++++++
4 files changed, 56 insertions(+)
create mode 100644 tools/perf/tests/workloads/inlineloop.c
diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c
index bd6ffa8e4578..e2490652f030 100644
--- a/tools/perf/tests/builtin-test.c
+++ b/tools/perf/tests/builtin-test.c
@@ -153,6 +153,7 @@ static struct test_workload *workloads[] = {
&workload__datasym,
&workload__landlock,
&workload__traploop,
+ &workload__inlineloop,
};
#define workloads__for_each(workload) \
diff --git a/tools/perf/tests/tests.h b/tools/perf/tests/tests.h
index cb67ddbd0375..1f0f8b267fb1 100644
--- a/tools/perf/tests/tests.h
+++ b/tools/perf/tests/tests.h
@@ -240,6 +240,7 @@ DECLARE_WORKLOAD(brstack);
DECLARE_WORKLOAD(datasym);
DECLARE_WORKLOAD(landlock);
DECLARE_WORKLOAD(traploop);
+DECLARE_WORKLOAD(inlineloop);
extern const char *dso_to_test;
extern const char *test_objdump_path;
diff --git a/tools/perf/tests/workloads/Build b/tools/perf/tests/workloads/Build
index fb1012cc4fc3..866a00bd14a0 100644
--- a/tools/perf/tests/workloads/Build
+++ b/tools/perf/tests/workloads/Build
@@ -8,9 +8,11 @@ perf-test-y += brstack.o
perf-test-y += datasym.o
perf-test-y += landlock.o
perf-test-y += traploop.o
+perf-test-y += inlineloop.o
CFLAGS_sqrtloop.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE
CFLAGS_leafloop.o = -g -O0 -fno-inline -fno-omit-frame-pointer -U_FORTIFY_SOURCE
CFLAGS_brstack.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE
CFLAGS_datasym.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE
CFLAGS_traploop.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE
+CFLAGS_inlineloop.o = -g -O2
diff --git a/tools/perf/tests/workloads/inlineloop.c b/tools/perf/tests/workloads/inlineloop.c
new file mode 100644
index 000000000000..bc82dfc7c410
--- /dev/null
+++ b/tools/perf/tests/workloads/inlineloop.c
@@ -0,0 +1,52 @@
+// SPDX-License-Identifier: GPL-2.0
+#include <pthread.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <unistd.h>
+#include <linux/compiler.h>
+#include "../tests.h"
+
+static volatile int a;
+static volatile sig_atomic_t done;
+
+static void sighandler(int sig __maybe_unused)
+{
+ done = 1;
+}
+
+static inline void __attribute__((always_inline)) leaf(int b)
+{
+again:
+ a += b;
+ if (!done)
+ goto again;
+}
+
+static inline void __attribute__((always_inline)) middle(int b)
+{
+ leaf(b);
+}
+
+static noinline void parent(int b)
+{
+ middle(b);
+}
+
+static int inlineloop(int argc, const char **argv)
+{
+ int sec = 1;
+
+ pthread_setname_np(pthread_self(), "perf-inlineloop");
+ if (argc > 0)
+ sec = atoi(argv[0]);
+
+ signal(SIGINT, sighandler);
+ signal(SIGALRM, sighandler);
+ alarm(sec);
+
+ parent(sec);
+
+ return 0;
+}
+
+DEFINE_WORKLOAD(inlineloop);
--
2.52.0.457.g6b5491de43-goog
next prev parent reply other threads:[~2026-01-11 4:13 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-11 4:13 [PATCH v3 0/7] perf: Add a libdw addr2line implementation Ian Rogers
2026-01-11 4:13 ` [PATCH v3 1/7] perf unwind-libdw: Fix invalid reference counts Ian Rogers
2026-01-11 4:13 ` [PATCH v3 2/7] perf addr2line: Add a libdw implementation Ian Rogers
2026-01-12 19:52 ` Arnaldo Carvalho de Melo
2026-01-12 21:23 ` Ian Rogers
2026-01-11 4:13 ` [PATCH v3 3/7] perf addr2line.c: Rename a2l_style to cmd_a2l_style Ian Rogers
2026-01-11 4:13 ` [PATCH v3 4/7] perf srcline: Add configuration support for the addr2line style Ian Rogers
2026-01-11 4:13 ` [PATCH v3 5/7] perf callchain: Fix srcline printing with inlines Ian Rogers
2026-01-11 4:13 ` Ian Rogers [this message]
2026-01-11 4:13 ` [PATCH v3 7/7] perf test: Test addr2line unwinding works with inline functions Ian Rogers
2026-01-12 11:18 ` [PATCH v3 0/7] perf: Add a libdw addr2line implementation James Clark
2026-01-12 14:49 ` Ian Rogers
2026-01-12 18:29 ` Ian Rogers
2026-01-13 12:03 ` James Clark
2026-01-13 23:47 ` Ian Rogers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260111041338.1817056-7-irogers@google.com \
--to=irogers@google.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=howardchu95@gmail.com \
--cc=james.clark@linaro.org \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=stephen.s.brennan@oracle.com \
--cc=tonyj@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox