mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-28 21:02:43 +01:00
Previously, builtin-trace.c directly included 15 embedded C files
(e.g. trace/beauty/mmap.c and fsconfig_arrays.c), which in turn depend
on dozens of generated beauty script arrays. To satisfy these embedded
inclusions, the global Makefile.perf would define all the generator
variables/rules and include them in the prepare umbrella target, choking
parallel build startup.
Furthermore, tools/perf/util/syscalltbl.c included its own generated mapper,
and util/env.c conditionally included arch_errno_names.c inline, splitting
consumers across directories and preventing clean Make encapsulation.
Refactor the framework to achieve better encapsulation:
1. Move util/syscalltbl.[ch] into trace/beauty/ to co-locate with all
generated code consumers.
2. Create fsconfig.c and flatten embedded beauty .c files to compile as
independent standalone objects via trace/beauty/Build, exporting their
formatting functions via beauty.h and env.h. Switch arch_errno_names.o
and syscalltbl.o assignments directly to perf-util-y and add an
unconditional top-level recursive kbuild hook (perf-util-y += trace/beauty/)
to compile them into libperf-util.a, resolving remote linkage for util/env.c,
util/bpf-trace-summary.c, and standalone python extensions.
3. Bridge private opaque references (struct trace) securely via accessors
trace__show_zeros() and trace__host(), avoiding header entanglements.
4. Consolidate all generator variables, script paths, and array generation
rules entirely out of Makefile.perf and place them directly inside the
exact local Build files where their output objects are compiled
(trace/beauty/Build and trace/beauty/tracepoints/Build), binding
prerequisites locally. Use directly inside
generator recipes to guarantee dynamic directory creation before script
redirection, and append across all rules to print
clean, standardized GEN ... file.c output during compilation.
5. Clean up clean target to recursively remove the generated directory
instead of relying on dozens of individual variables.
This unchokes the "prepare" target parallel barrier, allows make to evaluate
generation scripts purely locally where consumed, and flattens the tracepoint
formatting architecture.
Testing a parallel build (make -j28 all from scratch) shows improvements:
Before:
real 0m28.689s
user 2m38.490s
sys 0m30.148s
After:
real 0m27.642s
user 2m32.356s
sys 0m26.683s
So reclaiming ~9.6 seconds of raw CPU time and over 1 full second off
overall real-world build latency, by overlapping sub-make startup and
avoiding top-level double-parsing overhead.
Reviewed-by: Namhyung Kim <[email protected]>
Assisted-by: Gemini:gemini-3.1-pro-preview
Signed-off-by: Ian Rogers <[email protected]>
Tested-by: James Clark <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: Albert Ou <[email protected]>
Cc: Alexandre Chartre <[email protected]>
Cc: Alexandre Ghiti <[email protected]>
Cc: Andrii Nakryiko <[email protected]>
Cc: Ankur Arora <[email protected]>
Cc: Collin Funk <[email protected]>
Cc: Costa Shulyupin <[email protected]>
Cc: Daniel Borkmann <[email protected]>
Cc: Dapeng Mi <[email protected]>
Cc: David Sterba <[email protected]>
Cc: Dmitrii Dolgov <[email protected]>
Cc: Eduard Zingerman <[email protected]>
Cc: Howard Chu <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Kumar Kartikeya Dwivedi <[email protected]>
Cc: Leo Yan <[email protected]>
Cc: Markus Mayer <[email protected]>
Cc: Martin KaFai Lau <[email protected]>
Cc: Nathan Chancellor <[email protected]>
Cc: Nick Terrell <[email protected]>
Cc: Palmer Dabbelt <[email protected]>
Cc: Paul Walmsley <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Quentin Monnet <[email protected]>
Cc: Ricky Ringler <[email protected]>
Cc: Song Liu <[email protected]>
Cc: Swapnil Sapkal <[email protected]>
Cc: Thomas Falcon <[email protected]>
Cc: Tomas Glozar <[email protected]>
Cc: Yonghong Song <[email protected]>
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
107 lines
2.8 KiB
Python
107 lines
2.8 KiB
Python
perf-bench-y += builtin-bench.o
|
|
perf-y += builtin-annotate.o
|
|
perf-y += builtin-check.o
|
|
perf-y += builtin-config.o
|
|
perf-y += builtin-diff.o
|
|
perf-y += builtin-evlist.o
|
|
perf-y += builtin-ftrace.o
|
|
perf-y += builtin-help.o
|
|
perf-y += builtin-buildid-list.o
|
|
perf-y += builtin-buildid-cache.o
|
|
perf-y += builtin-kallsyms.o
|
|
perf-y += builtin-list.o
|
|
perf-y += builtin-record.o
|
|
perf-y += builtin-report.o
|
|
perf-y += builtin-stat.o
|
|
perf-y += builtin-top.o
|
|
perf-y += builtin-script.o
|
|
perf-y += builtin-kvm.o
|
|
perf-y += builtin-inject.o
|
|
perf-y += builtin-mem.o
|
|
perf-y += builtin-data.o
|
|
perf-y += builtin-version.o
|
|
perf-y += builtin-c2c.o
|
|
perf-y += builtin-daemon.o
|
|
|
|
perf-$(CONFIG_LIBTRACEEVENT) += builtin-kmem.o
|
|
perf-$(CONFIG_LIBTRACEEVENT) += builtin-kwork.o
|
|
perf-$(CONFIG_LIBTRACEEVENT) += builtin-lock.o
|
|
perf-$(CONFIG_LIBTRACEEVENT) += builtin-sched.o
|
|
perf-$(CONFIG_LIBTRACEEVENT) += builtin-timechart.o
|
|
|
|
ifeq ($(CONFIG_LIBTRACEEVENT),y)
|
|
perf-$(CONFIG_TRACE) += builtin-trace.o
|
|
perf-$(CONFIG_TRACE) += trace/beauty/
|
|
endif
|
|
|
|
perf-util-y += trace/beauty/
|
|
|
|
perf-$(CONFIG_LIBELF) += builtin-probe.o
|
|
|
|
perf-bench-y += bench/
|
|
perf-test-y += tests/
|
|
|
|
perf-y += perf.o
|
|
|
|
paths += -DPERF_HTML_PATH="BUILD_STR($(htmldir_SQ))"
|
|
paths += -DPERF_INFO_PATH="BUILD_STR($(infodir_SQ))"
|
|
paths += -DPERF_MAN_PATH="BUILD_STR($(mandir_SQ))"
|
|
|
|
CFLAGS_builtin-help.o += $(paths)
|
|
CFLAGS_builtin-timechart.o += $(paths)
|
|
CFLAGS_perf.o += -DPERF_HTML_PATH="BUILD_STR($(htmldir_SQ))" \
|
|
-DPERF_EXEC_PATH="BUILD_STR($(perfexecdir_SQ))" \
|
|
-DPREFIX="BUILD_STR($(prefix_SQ))"
|
|
CFLAGS_builtin-trace.o += -DSTRACE_GROUPS_DIR="BUILD_STR($(STRACE_GROUPS_DIR_SQ))"
|
|
CFLAGS_builtin-report.o += -DTIPDIR="BUILD_STR($(tipdir_SQ))"
|
|
CFLAGS_builtin-report.o += -DDOCDIR="BUILD_STR($(srcdir_SQ)/Documentation)"
|
|
|
|
perf-util-y += util/
|
|
perf-util-y += arch/
|
|
perf-y += arch/
|
|
perf-test-y += arch/
|
|
perf-ui-y += ui/
|
|
perf-util-y += scripts/
|
|
|
|
gtk-y += ui/gtk/
|
|
|
|
ifdef SHELLCHECK
|
|
SHELL_TESTS := $(wildcard *.sh)
|
|
SHELL_TEST_LOGS := $(SHELL_TESTS:%=%.shellcheck_log)
|
|
else
|
|
SHELL_TESTS :=
|
|
SHELL_TEST_LOGS :=
|
|
endif
|
|
|
|
$(OUTPUT)%.shellcheck_log: %
|
|
$(call rule_mkdir)
|
|
$(Q)$(call echo-cmd,test)$(SHELLCHECK) "$<" > $@ || (cat $@ && rm $@ && false)
|
|
|
|
perf-y += $(SHELL_TEST_LOGS)
|
|
|
|
ifdef MYPY
|
|
PY_TESTS := $(shell find python -type f -name '*.py')
|
|
MYPY_TEST_LOGS := $(PY_TESTS:python/%=python/%.mypy_log)
|
|
else
|
|
MYPY_TEST_LOGS :=
|
|
endif
|
|
|
|
$(OUTPUT)%.mypy_log: %
|
|
$(call rule_mkdir)
|
|
$(Q)$(call echo-cmd,test)mypy "$<" > $@ || (cat $@ && rm $@ && false)
|
|
|
|
perf-y += $(MYPY_TEST_LOGS)
|
|
|
|
ifdef PYLINT
|
|
PY_TESTS := $(shell find python -type f -name '*.py')
|
|
PYLINT_TEST_LOGS := $(PY_TESTS:python/%=python/%.pylint_log)
|
|
else
|
|
PYLINT_TEST_LOGS :=
|
|
endif
|
|
|
|
$(OUTPUT)%.pylint_log: %
|
|
$(call rule_mkdir)
|
|
$(Q)$(call echo-cmd,test)pylint "$<" > $@ || (cat $@ && rm $@ && false)
|
|
|
|
perf-y += $(PYLINT_TEST_LOGS)
|