Skip to content

Commit 21cc3bc

Browse files
captain5050namhyung
authored andcommitted
perf bench: Make bench its own library
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> Cc: Suzuki K Poulose <suzuki.poulose@arm.com> Cc: Kees Cook <keescook@chromium.org> Cc: Palmer Dabbelt <palmer@dabbelt.com> Cc: Albert Ou <aou@eecs.berkeley.edu> Cc: Nick Terrell <terrelln@fb.com> Cc: Gary Guo <gary@garyguo.net> Cc: Alex Gaynor <alex.gaynor@gmail.com> Cc: Boqun Feng <boqun.feng@gmail.com> Cc: Wedson Almeida Filho <wedsonaf@gmail.com> Cc: Ze Gao <zegao2021@gmail.com> Cc: Alice Ryhl <aliceryhl@google.com> Cc: Andrei Vagin <avagin@google.com> Cc: Yicong Yang <yangyicong@hisilicon.com> Cc: Jonathan Cameron <jonathan.cameron@huawei.com> Cc: Guo Ren <guoren@kernel.org> Cc: Miguel Ojeda <ojeda@kernel.org> Cc: Will Deacon <will@kernel.org> Cc: Mike Leach <mike.leach@linaro.org> Cc: Leo Yan <leo.yan@linux.dev> Cc: Oliver Upton <oliver.upton@linux.dev> Cc: John Garry <john.g.garry@oracle.com> Cc: Benno Lossin <benno.lossin@proton.me> Cc: Björn Roy Baron <bjorn3_gh@protonmail.com> Cc: Andreas Hindborg <a.hindborg@samsung.com> Cc: Paul Walmsley <paul.walmsley@sifive.com> Signed-off-by: Namhyung Kim <namhyung@kernel.org> Link: https://lore.kernel.org/r/20240625214117.953777-6-irogers@google.com
1 parent 1dad99a commit 21cc3bc

File tree

3 files changed

+35
-26
lines changed

3 files changed

+35
-26
lines changed

tools/perf/Build

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
perf-y += builtin-bench.o
1+
perf-bench-y += builtin-bench.o
22
perf-y += builtin-annotate.o
33
perf-y += builtin-config.o
44
perf-y += builtin-diff.o
@@ -35,7 +35,7 @@ endif
3535

3636
perf-$(CONFIG_LIBELF) += builtin-probe.o
3737

38-
perf-y += bench/
38+
perf-bench-y += bench/
3939
perf-test-y += tests/
4040

4141
perf-y += perf.o

tools/perf/Makefile.perf

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,9 @@ endif
425425

426426
export PERL_PATH
427427

428+
LIBPERF_BENCH_IN := $(OUTPUT)perf-bench-in.o
429+
LIBPERF_BENCH := $(OUTPUT)libperf-bench.a
430+
428431
LIBPERF_TEST_IN := $(OUTPUT)perf-test-in.o
429432
LIBPERF_TEST := $(OUTPUT)libperf-test.a
430433

@@ -438,7 +441,7 @@ PERFLIBS = $(LIBAPI) $(LIBPERF) $(LIBSUBCMD) $(LIBSYMBOL)
438441
ifdef LIBBPF_STATIC
439442
PERFLIBS += $(LIBBPF)
440443
endif
441-
PERFLIBS += $(LIBPERF_TEST) $(LIBPERF_UI) $(LIBPMU_EVENTS)
444+
PERFLIBS += $(LIBPERF_BENCH) $(LIBPERF_TEST) $(LIBPERF_UI) $(LIBPMU_EVENTS)
442445

443446
# We choose to avoid "if .. else if .. else .. endif endif"
444447
# because maintaining the nesting to match is a pain. If
@@ -740,6 +743,12 @@ $(LIBPMU_EVENTS_IN): FORCE prepare
740743
$(LIBPMU_EVENTS): $(LIBPMU_EVENTS_IN)
741744
$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $<
742745

746+
$(LIBPERF_BENCH_IN): FORCE prepare
747+
$(Q)$(MAKE) $(build)=perf-bench
748+
749+
$(LIBPERF_BENCH): $(LIBPERF_BENCH_IN)
750+
$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $<
751+
743752
$(LIBPERF_TEST_IN): FORCE prepare
744753
$(Q)$(MAKE) $(build)=perf-test
745754

tools/perf/bench/Build

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
perf-y += sched-messaging.o
2-
perf-y += sched-pipe.o
3-
perf-y += sched-seccomp-notify.o
4-
perf-y += syscall.o
5-
perf-y += mem-functions.o
6-
perf-y += futex-hash.o
7-
perf-y += futex-wake.o
8-
perf-y += futex-wake-parallel.o
9-
perf-y += futex-requeue.o
10-
perf-y += futex-lock-pi.o
11-
perf-y += epoll-wait.o
12-
perf-y += epoll-ctl.o
13-
perf-y += synthesize.o
14-
perf-y += kallsyms-parse.o
15-
perf-y += find-bit-bench.o
16-
perf-y += inject-buildid.o
17-
perf-y += evlist-open-close.o
18-
perf-y += breakpoint.o
19-
perf-y += pmu-scan.o
20-
perf-y += uprobe.o
1+
perf-bench-y += sched-messaging.o
2+
perf-bench-y += sched-pipe.o
3+
perf-bench-y += sched-seccomp-notify.o
4+
perf-bench-y += syscall.o
5+
perf-bench-y += mem-functions.o
6+
perf-bench-y += futex-hash.o
7+
perf-bench-y += futex-wake.o
8+
perf-bench-y += futex-wake-parallel.o
9+
perf-bench-y += futex-requeue.o
10+
perf-bench-y += futex-lock-pi.o
11+
perf-bench-y += epoll-wait.o
12+
perf-bench-y += epoll-ctl.o
13+
perf-bench-y += synthesize.o
14+
perf-bench-y += kallsyms-parse.o
15+
perf-bench-y += find-bit-bench.o
16+
perf-bench-y += inject-buildid.o
17+
perf-bench-y += evlist-open-close.o
18+
perf-bench-y += breakpoint.o
19+
perf-bench-y += pmu-scan.o
20+
perf-bench-y += uprobe.o
2121

22-
perf-$(CONFIG_X86_64) += mem-memcpy-x86-64-asm.o
23-
perf-$(CONFIG_X86_64) += mem-memset-x86-64-asm.o
22+
perf-bench-$(CONFIG_X86_64) += mem-memcpy-x86-64-asm.o
23+
perf-bench-$(CONFIG_X86_64) += mem-memset-x86-64-asm.o
2424

25-
perf-$(CONFIG_NUMA) += numa.o
25+
perf-bench-$(CONFIG_NUMA) += numa.o

0 commit comments

Comments
 (0)