tools/perf/pmu-events/Build

Source file repositories/reference/linux-study-clean/tools/perf/pmu-events/Build

File Facts

System
Linux kernel
Corpus path
tools/perf/pmu-events/Build
Extension
[no extension]
Size
8373 bytes
Lines
230
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: tools
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

EMPTY_PMU_EVENTS_C = pmu-events/empty-pmu-events.c
# pmu-events.c will be generated by jevents.py or copied from EMPTY_PMU_EVENTS_C
PMU_EVENTS_C	=  $(OUTPUT)pmu-events/pmu-events.c
pmu-events-y	+= pmu-events.o

# pmu-events.c file is generated in the OUTPUT directory so it needs a
# separate rule to depend on it properly
$(OUTPUT)pmu-events/pmu-events.o: $(PMU_EVENTS_C)
	$(call rule_mkdir)
	$(call if_changed_dep,cc_o_c)

# Message for $(call echo-cmd,cp), possibly remove the src file from
# the destination to save space in the build log.
quiet_cmd_cp   = COPY    $(patsubst %$<,%,$@) <- $<

# --- NO_JEVENTS=1 build ---
ifeq ($(NO_JEVENTS),1)
$(PMU_EVENTS_C): $(EMPTY_PMU_EVENTS_C)
	$(call rule_mkdir)
	$(Q)$(call echo-cmd,cp)cp $< $@
else
# --- Regular build ---

# Setup the JEVENTS_ARCH and JEVENTS_MODEL
ifeq ($(JEVENTS_ARCH),)
JEVENTS_ARCH=$(SRCARCH)
endif
JEVENTS_MODEL ?= all

# The input json/csv files
SRC_DIR		:= pmu-events/arch
ifeq ($(JEVENTS_ARCH),all)
SRC_JSON	:= $(shell find $(SRC_DIR) -name '*.json' -o -name '*.csv')
else
SRC_JSON	:= $(shell find $(SRC_DIR)/common $(SRC_DIR)/test $(SRC_DIR)/$(JEVENTS_ARCH) -name '*.json' -o -name '*.csv')
endif

# Python to build the generic legacy cache events
LEGACY_CACHE_PY	=  pmu-events/make_legacy_cache.py
LEGACY_CACHE_JSON = $(OUTPUT)pmu-events/arch/common/common/legacy-cache.json
GEN_JSON = $(LEGACY_CACHE_JSON)

$(LEGACY_CACHE_JSON): $(LEGACY_CACHE_PY)
	$(call rule_mkdir)
	$(Q)$(call echo-cmd,gen)$(PYTHON) $(LEGACY_CACHE_PY) > $@

# Python to generate architectural metrics
GEN_METRIC_DEPS := pmu-events/metric.py pmu-events/common_metrics.py
# Functions to extract the model from an extra-metrics.json or extra-metricgroups.json path.
model_name = $(shell echo $(1)|sed -e 's@.\+/\(.*\)/extra-metric.*\.json@\1@')
vendor_name = $(shell echo $(1)|sed -e 's@.\+/\(.*\)/[^/]*/extra-metric.*\.json@\1@')

ifeq ($(JEVENTS_ARCH),$(filter $(JEVENTS_ARCH),x86 all))
# Generate AMD Json
ZENS = $(shell ls -d pmu-events/arch/x86/amdzen*)
ZEN_METRICS = $(foreach x,$(ZENS),$(OUTPUT)$(x)/extra-metrics.json)
ZEN_METRICGROUPS = $(foreach x,$(ZENS),$(OUTPUT)$(x)/extra-metricgroups.json)
GEN_JSON += $(ZEN_METRICS) $(ZEN_METRICGROUPS)

$(ZEN_METRICS): pmu-events/amd_metrics.py $(GEN_METRIC_DEPS)
	$(call rule_mkdir)
	$(Q)$(call echo-cmd,gen)$(PYTHON) $< $(call model_name,$@) pmu-events/arch > $@

$(ZEN_METRICGROUPS): pmu-events/amd_metrics.py $(GEN_METRIC_DEPS)
	$(call rule_mkdir)
	$(Q)$(call echo-cmd,gen)$(PYTHON) $< -metricgroups $(call model_name,$@) pmu-events/arch > $@

endif

ifeq ($(JEVENTS_ARCH),$(filter $(JEVENTS_ARCH),arm64 all))

Annotation

Implementation Notes