Skip to content

Commit b04cbd7

Browse files
committed
perf util: Make util its own library
JIRA: https://issues.redhat.com/browse/RHEL-29795 upstream ======== commit e467705 Author: Ian Rogers <irogers@google.com> Date: Tue Jun 25 14:41:15 2024 -0700 description =========== Make the util directory into its own library. This is done to avoid compiling code twice, once for the perf tool and once for the perf python module. For convenience: arch/common.c scripts/perl/Perf-Trace-Util/Context.c scripts/python/Perf-Trace-Util/Context.c are made part of this library. 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-7-irogers@google.com Signed-off-by: Michael Petlan <mpetlan@redhat.com>
1 parent 1dd74da commit b04cbd7

File tree

36 files changed

+316
-305
lines changed

36 files changed

+316
-305
lines changed

tools/perf/Build

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,12 @@ CFLAGS_builtin-trace.o += -DSTRACE_GROUPS_DIR="BUILD_STR($(STRACE_GROUPS_DIR_
5353
CFLAGS_builtin-report.o += -DTIPDIR="BUILD_STR($(tipdir_SQ))"
5454
CFLAGS_builtin-report.o += -DDOCDIR="BUILD_STR($(srcdir_SQ)/Documentation)"
5555

56-
perf-y += util/
56+
perf-util-y += util/
57+
perf-util-y += arch/
5758
perf-y += arch/
5859
perf-test-y += arch/
5960
perf-ui-y += ui/
60-
perf-y += scripts/
61+
perf-util-y += scripts/
6162

6263
gtk-y += ui/gtk/
6364

tools/perf/Makefile.perf

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,14 +435,18 @@ LIBPERF_TEST := $(OUTPUT)libperf-test.a
435435
LIBPERF_UI_IN := $(OUTPUT)perf-ui-in.o
436436
LIBPERF_UI := $(OUTPUT)libperf-ui.a
437437

438+
LIBPERF_UTIL_IN := $(OUTPUT)perf-util-in.o
439+
LIBPERF_UTIL := $(OUTPUT)libperf-util.a
440+
438441
LIBPMU_EVENTS_IN := $(OUTPUT)pmu-events/pmu-events-in.o
439442
LIBPMU_EVENTS := $(OUTPUT)libpmu-events.a
440443

441444
PERFLIBS = $(LIBAPI) $(LIBPERF) $(LIBSUBCMD) $(LIBSYMBOL)
442445
ifdef LIBBPF_STATIC
443446
PERFLIBS += $(LIBBPF)
444447
endif
445-
PERFLIBS += $(LIBPERF_BENCH) $(LIBPERF_TEST) $(LIBPERF_UI) $(LIBPMU_EVENTS)
448+
PERFLIBS += $(LIBPERF_BENCH) $(LIBPERF_TEST) $(LIBPERF_UI) $(LIBPERF_UTIL)
449+
PERFLIBS += $(LIBPMU_EVENTS)
446450

447451
# We choose to avoid "if .. else if .. else .. endif endif"
448452
# because maintaining the nesting to match is a pain. If
@@ -762,6 +766,12 @@ $(LIBPERF_UI_IN): FORCE prepare
762766
$(LIBPERF_UI): $(LIBPERF_UI_IN)
763767
$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $<
764768

769+
$(LIBPERF_UTIL_IN): FORCE prepare
770+
$(Q)$(MAKE) $(build)=perf-util
771+
772+
$(LIBPERF_UTIL): $(LIBPERF_UTIL_IN)
773+
$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $<
774+
765775
$(OUTPUT)perf: $(PERFLIBS) $(PERF_IN)
766776
$(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) \
767777
$(PERF_IN) $(LIBS) -o $@

tools/perf/arch/Build

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
perf-y += common.o
2-
perf-y += $(SRCARCH)/
1+
perf-util-y += common.o
32
perf-test-y += $(SRCARCH)/
3+
perf-util-y += $(SRCARCH)/

tools/perf/arch/arm/Build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
perf-y += util/
1+
perf-util-y += util/
22
perf-test-$(CONFIG_DWARF_UNWIND) += tests/

tools/perf/arch/arm/util/Build

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
perf-y += perf_regs.o
1+
perf-util-y += perf_regs.o
22

3-
perf-$(CONFIG_DWARF) += dwarf-regs.o
3+
perf-util-$(CONFIG_DWARF) += dwarf-regs.o
44

5-
perf-$(CONFIG_LOCAL_LIBUNWIND) += unwind-libunwind.o
6-
perf-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o
5+
perf-util-$(CONFIG_LOCAL_LIBUNWIND) += unwind-libunwind.o
6+
perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o
77

8-
perf-$(CONFIG_AUXTRACE) += pmu.o auxtrace.o cs-etm.o
8+
perf-util-$(CONFIG_AUXTRACE) += pmu.o auxtrace.o cs-etm.o

tools/perf/arch/arm64/Build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
perf-y += util/
1+
perf-util-y += util/
22
perf-test-y += tests/

tools/perf/arch/arm64/util/Build

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
perf-y += header.o
2-
perf-y += machine.o
3-
perf-y += perf_regs.o
4-
perf-y += tsc.o
5-
perf-y += pmu.o
6-
perf-$(CONFIG_LIBTRACEEVENT) += kvm-stat.o
7-
perf-$(CONFIG_DWARF) += dwarf-regs.o
8-
perf-$(CONFIG_LOCAL_LIBUNWIND) += unwind-libunwind.o
9-
perf-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o
1+
perf-util-y += header.o
2+
perf-util-y += machine.o
3+
perf-util-y += perf_regs.o
4+
perf-util-y += tsc.o
5+
perf-util-y += pmu.o
6+
perf-util-$(CONFIG_LIBTRACEEVENT) += kvm-stat.o
7+
perf-util-$(CONFIG_DWARF) += dwarf-regs.o
8+
perf-util-$(CONFIG_LOCAL_LIBUNWIND) += unwind-libunwind.o
9+
perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o
1010

11-
perf-$(CONFIG_AUXTRACE) += ../../arm/util/pmu.o \
11+
perf-util-$(CONFIG_AUXTRACE) += ../../arm/util/pmu.o \
1212
../../arm/util/auxtrace.o \
1313
../../arm/util/cs-etm.o \
1414
arm-spe.o mem-events.o hisi-ptt.o

tools/perf/arch/csky/Build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
perf-y += util/
1+
perf-util-y += util/

tools/perf/arch/csky/util/Build

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
perf-y += perf_regs.o
1+
perf-util-y += perf_regs.o
22

3-
perf-$(CONFIG_DWARF) += dwarf-regs.o
4-
perf-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o
3+
perf-util-$(CONFIG_DWARF) += dwarf-regs.o
4+
perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o

tools/perf/arch/loongarch/Build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
perf-y += util/
1+
perf-util-y += util/

0 commit comments

Comments
 (0)