From: Ian Rogers <irogers@google.com>
To: "Peter Zijlstra" <peterz@infradead.org>,
"Ingo Molnar" <mingo@redhat.com>,
"Arnaldo Carvalho de Melo" <acme@kernel.org>,
"Namhyung Kim" <namhyung@kernel.org>,
"Mark Rutland" <mark.rutland@arm.com>,
"Alexander Shishkin" <alexander.shishkin@linux.intel.com>,
"Jiri Olsa" <jolsa@kernel.org>, "Ian Rogers" <irogers@google.com>,
"Adrian Hunter" <adrian.hunter@intel.com>,
"Kan Liang" <kan.liang@linux.intel.com>,
"John Garry" <john.g.garry@oracle.com>,
"Will Deacon" <will@kernel.org>,
"James Clark" <james.clark@arm.com>,
"Mike Leach" <mike.leach@linaro.org>,
"Leo Yan" <leo.yan@linux.dev>, "Guo Ren" <guoren@kernel.org>,
"Paul Walmsley" <paul.walmsley@sifive.com>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Albert Ou" <aou@eecs.berkeley.edu>,
"Suzuki K Poulose" <suzuki.poulose@arm.com>,
"Yicong Yang" <yangyicong@hisilicon.com>,
"Jonathan Cameron" <jonathan.cameron@huawei.com>,
"Miguel Ojeda" <ojeda@kernel.org>,
"Alex Gaynor" <alex.gaynor@gmail.com>,
"Wedson Almeida Filho" <wedsonaf@gmail.com>,
"Boqun Feng" <boqun.feng@gmail.com>,
"Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <benno.lossin@proton.me>,
"Andreas Hindborg" <a.hindborg@samsung.com>,
"Alice Ryhl" <aliceryhl@google.com>,
"Nick Terrell" <terrelln@fb.com>,
"Ravi Bangoria" <ravi.bangoria@amd.com>,
"Kees Cook" <keescook@chromium.org>,
"Andrei Vagin" <avagin@google.com>,
"Athira Jajeev" <atrajeev@linux.vnet.ibm.com>,
"Oliver Upton" <oliver.upton@linux.dev>,
"Ze Gao" <zegao2021@gmail.com>,
linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org,
linux-riscv@lists.infradead.org, coresight@lists.linaro.org,
rust-for-linux@vger.kernel.org, bpf@vger.kernel.org
Subject: [PATCH v3 5/8] perf bench: Make bench its own library
Date: Thu, 13 Jun 2024 16:31:19 -0700 [thread overview]
Message-ID: <20240613233122.3564730-6-irogers@google.com> (raw)
In-Reply-To: <20240613233122.3564730-1-irogers@google.com>
Make the benchmark code into a library so it may be linked against
things like the python module to avoid compiling code twice.
Signed-off-by: Ian Rogers <irogers@google.com>
Reviewed-by: James Clark <james.clark@arm.com>
---
tools/perf/Build | 4 ++--
tools/perf/Makefile.perf | 11 +++++++++-
tools/perf/bench/Build | 46 ++++++++++++++++++++--------------------
3 files changed, 35 insertions(+), 26 deletions(-)
diff --git a/tools/perf/Build b/tools/perf/Build
index fddd45ab35b4..2787f5630ff7 100644
--- a/tools/perf/Build
+++ b/tools/perf/Build
@@ -1,4 +1,4 @@
-perf-y += builtin-bench.o
+perf-bench-y += builtin-bench.o
perf-y += builtin-annotate.o
perf-y += builtin-config.o
perf-y += builtin-diff.o
@@ -35,7 +35,7 @@ endif
perf-$(CONFIG_LIBELF) += builtin-probe.o
-perf-y += bench/
+perf-bench-y += bench/
perf-test-y += tests/
perf-y += perf.o
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 9fa69dd0b472..4a3c000b9845 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -425,6 +425,9 @@ endif
export PERL_PATH
+LIBPERF_BENCH_IN := $(OUTPUT)perf-bench-in.o
+LIBPERF_BENCH := $(OUTPUT)libperf-bench.a
+
LIBPERF_TEST_IN := $(OUTPUT)perf-test-in.o
LIBPERF_TEST := $(OUTPUT)libperf-test.a
@@ -438,7 +441,7 @@ PERFLIBS = $(LIBAPI) $(LIBPERF) $(LIBSUBCMD) $(LIBSYMBOL)
ifdef LIBBPF_STATIC
PERFLIBS += $(LIBBPF)
endif
-PERFLIBS += $(LIBPERF_TEST) $(LIBPERF_UI) $(LIBPMU_EVENTS)
+PERFLIBS += $(LIBPERF_BENCH) $(LIBPERF_TEST) $(LIBPERF_UI) $(LIBPMU_EVENTS)
# We choose to avoid "if .. else if .. else .. endif endif"
# because maintaining the nesting to match is a pain. If
@@ -740,6 +743,12 @@ $(LIBPMU_EVENTS_IN): FORCE prepare
$(LIBPMU_EVENTS): $(LIBPMU_EVENTS_IN)
$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $<
+$(LIBPERF_BENCH_IN): FORCE prepare
+ $(Q)$(MAKE) $(build)=perf-bench
+
+$(LIBPERF_BENCH): $(LIBPERF_BENCH_IN)
+ $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $<
+
$(LIBPERF_TEST_IN): FORCE prepare
$(Q)$(MAKE) $(build)=perf-test
diff --git a/tools/perf/bench/Build b/tools/perf/bench/Build
index c2ab30907ae7..279ab2ab4abe 100644
--- a/tools/perf/bench/Build
+++ b/tools/perf/bench/Build
@@ -1,25 +1,25 @@
-perf-y += sched-messaging.o
-perf-y += sched-pipe.o
-perf-y += sched-seccomp-notify.o
-perf-y += syscall.o
-perf-y += mem-functions.o
-perf-y += futex-hash.o
-perf-y += futex-wake.o
-perf-y += futex-wake-parallel.o
-perf-y += futex-requeue.o
-perf-y += futex-lock-pi.o
-perf-y += epoll-wait.o
-perf-y += epoll-ctl.o
-perf-y += synthesize.o
-perf-y += kallsyms-parse.o
-perf-y += find-bit-bench.o
-perf-y += inject-buildid.o
-perf-y += evlist-open-close.o
-perf-y += breakpoint.o
-perf-y += pmu-scan.o
-perf-y += uprobe.o
+perf-bench-y += sched-messaging.o
+perf-bench-y += sched-pipe.o
+perf-bench-y += sched-seccomp-notify.o
+perf-bench-y += syscall.o
+perf-bench-y += mem-functions.o
+perf-bench-y += futex-hash.o
+perf-bench-y += futex-wake.o
+perf-bench-y += futex-wake-parallel.o
+perf-bench-y += futex-requeue.o
+perf-bench-y += futex-lock-pi.o
+perf-bench-y += epoll-wait.o
+perf-bench-y += epoll-ctl.o
+perf-bench-y += synthesize.o
+perf-bench-y += kallsyms-parse.o
+perf-bench-y += find-bit-bench.o
+perf-bench-y += inject-buildid.o
+perf-bench-y += evlist-open-close.o
+perf-bench-y += breakpoint.o
+perf-bench-y += pmu-scan.o
+perf-bench-y += uprobe.o
-perf-$(CONFIG_X86_64) += mem-memcpy-x86-64-asm.o
-perf-$(CONFIG_X86_64) += mem-memset-x86-64-asm.o
+perf-bench-$(CONFIG_X86_64) += mem-memcpy-x86-64-asm.o
+perf-bench-$(CONFIG_X86_64) += mem-memset-x86-64-asm.o
-perf-$(CONFIG_NUMA) += numa.o
+perf-bench-$(CONFIG_NUMA) += numa.o
--
2.45.2.627.g7a2c4fd464-goog
next prev parent reply other threads:[~2024-06-13 23:31 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-13 23:31 [PATCH v3 0/8] Refactor perf python module build Ian Rogers
2024-06-13 23:31 ` [PATCH v3 1/8] perf build: Add '*.a' to clean targets Ian Rogers
2024-06-14 9:33 ` James Clark
2024-06-13 23:31 ` [PATCH v3 2/8] perf ui: Make ui its own library Ian Rogers
2024-06-13 23:31 ` [PATCH v3 3/8] perf pmu-events: Make pmu-events a library Ian Rogers
2024-06-13 23:31 ` [PATCH v3 4/8] perf test: Make tests its own library Ian Rogers
2024-06-13 23:31 ` Ian Rogers [this message]
2024-06-13 23:31 ` [PATCH v3 6/8] perf util: Make util " Ian Rogers
2024-06-13 23:31 ` [PATCH v3 7/8] perf python: Switch module to linking libraries from building source Ian Rogers
2024-06-24 22:26 ` Namhyung Kim
2024-06-25 12:24 ` James Clark
2024-06-25 17:48 ` Namhyung Kim
2024-06-25 18:14 ` Ian Rogers
2024-06-13 23:31 ` [PATCH v3 8/8] perf python: Clean up build dependencies Ian Rogers
2024-06-24 21:46 ` [PATCH v3 0/8] Refactor perf python module build 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=20240613233122.3564730-6-irogers@google.com \
--to=irogers@google.com \
--cc=a.hindborg@samsung.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alex.gaynor@gmail.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=aliceryhl@google.com \
--cc=aou@eecs.berkeley.edu \
--cc=atrajeev@linux.vnet.ibm.com \
--cc=avagin@google.com \
--cc=benno.lossin@proton.me \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=coresight@lists.linaro.org \
--cc=gary@garyguo.net \
--cc=guoren@kernel.org \
--cc=james.clark@arm.com \
--cc=john.g.garry@oracle.com \
--cc=jolsa@kernel.org \
--cc=jonathan.cameron@huawei.com \
--cc=kan.liang@linux.intel.com \
--cc=keescook@chromium.org \
--cc=leo.yan@linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-csky@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=mark.rutland@arm.com \
--cc=mike.leach@linaro.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=ojeda@kernel.org \
--cc=oliver.upton@linux.dev \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=peterz@infradead.org \
--cc=ravi.bangoria@amd.com \
--cc=rust-for-linux@vger.kernel.org \
--cc=suzuki.poulose@arm.com \
--cc=terrelln@fb.com \
--cc=wedsonaf@gmail.com \
--cc=will@kernel.org \
--cc=yangyicong@hisilicon.com \
--cc=zegao2021@gmail.com \
/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;
as well as URLs for NNTP newsgroup(s).