Skip to content

Commit 0695e57

Browse files
Jiri Olsaacmel
authored andcommitted
perf tools: Factor features display code
Currently the we display all detected features/libraries by following rules: - if one of the features is missing - if it's build from clean tree This patch changes changes this behavior in several ways. - We no longer display all detected features, only detected libraries are displayed by default: $ make BUILD: Doing 'make -j4' parallel build Auto-detecting system features: ... dwarf: [ on ] ... glibc: [ on ] ... gtk2: [ on ] ... libaudit: [ on ] ... libbfd: [ on ] ... libelf: [ on ] ... libnuma: [ on ] ... libperl: [ on ] ... libpython: [ on ] ... libslang: [ on ] ... libunwind: [ on ] The assumption is, that above libraries are the most interesting part of the detection, while we don't care much about detection of on-exit support. - If all above libraries are detected, the default is not shown on subsequent builds. - If one of the above libraries is missing, the detection output is forced. - The features status is stored in PERF-FEATURES file and the detection output is forced in case the there's difference between the file contents and currently detected features. - If you want to see all detected features, you can use VF=1 make variable, that forces the detected features output. $ make VF=1 BUILD: Doing 'make -j4' parallel build Auto-detecting system features: ... dwarf: [ on ] ... glibc: [ on ] ... gtk2: [ on ] ... libaudit: [ on ] ... libbfd: [ on ] ... libelf: [ on ] ... libnuma: [ on ] ... libperl: [ on ] ... libpython: [ on ] ... libslang: [ on ] ... libunwind: [ on ] ... backtrace: [ on ] ... fortify-source: [ on ] ... gtk2-infobar: [ on ] ... libelf-getphdrnum: [ on ] ... libelf-mmap: [ on ] ... libpython-version: [ on ] ... on-exit: [ on ] ... stackprotector-all: [ on ] ... timerfd: [ on ] ... libunwind-debug-frame: [ OFF ] ... bionic: [ OFF ] Signed-off-by: Jiri Olsa <jolsa@redhat.com> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Jean Pihet <jean.pihet@linaro.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1392825179-5228-2-git-send-email-jolsa@redhat.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent da237ed commit 0695e57

2 files changed

Lines changed: 85 additions & 42 deletions

File tree

‎tools/perf/Makefile.perf‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ include config/utilities.mak
77

88
# Define V to have a more verbose compile.
99
#
10+
# Define VF to have a more verbose feature check output.
11+
#
1012
# Define O to save output files in a separate directory.
1113
#
1214
# Define ARCH as name of target architecture if you want cross-builds.
@@ -897,7 +899,7 @@ config-clean:
897899
clean: $(LIBTRACEEVENT)-clean $(LIBAPIKFS)-clean config-clean
898900
$(call QUIET_CLEAN, core-objs) $(RM) $(LIB_OBJS) $(BUILTIN_OBJS) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf.o $(LANG_BINDINGS) $(GTK_OBJS)
899901
$(call QUIET_CLEAN, core-progs) $(RM) $(ALL_PROGRAMS) perf
900-
$(call QUIET_CLEAN, core-gen) $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)PERF-CFLAGS $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex*
902+
$(call QUIET_CLEAN, core-gen) $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)PERF-CFLAGS $(OUTPUT)PERF-FEATURES $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex*
901903
$(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean
902904
$(python-clean)
903905

‎tools/perf/config/Makefile‎

Lines changed: 82 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,32 @@ CORE_FEATURE_TESTS = \
149149
stackprotector-all \
150150
timerfd
151151

152+
LIB_FEATURE_TESTS = \
153+
dwarf \
154+
glibc \
155+
gtk2 \
156+
libaudit \
157+
libbfd \
158+
libelf \
159+
libnuma \
160+
libperl \
161+
libpython \
162+
libslang \
163+
libunwind
164+
165+
VF_FEATURE_TESTS = \
166+
backtrace \
167+
fortify-source \
168+
gtk2-infobar \
169+
libelf-getphdrnum \
170+
libelf-mmap \
171+
libpython-version \
172+
on-exit \
173+
stackprotector-all \
174+
timerfd \
175+
libunwind-debug-frame \
176+
bionic
177+
152178
# Set FEATURE_CHECK_(C|LD)FLAGS-all for all CORE_FEATURE_TESTS features.
153179
# If in the future we need per-feature checks/flags for features not
154180
# mentioned in this list we need to refactor this ;-).
@@ -160,17 +186,6 @@ endef
160186

161187
$(foreach feat,$(CORE_FEATURE_TESTS),$(call set_test_all_flags,$(feat)))
162188

163-
#
164-
# So here we detect whether test-all was rebuilt, to be able
165-
# to skip the print-out of the long features list if the file
166-
# existed before and after it was built:
167-
#
168-
ifeq ($(wildcard $(OUTPUT)config/feature-checks/test-all.bin),)
169-
test-all-failed := 1
170-
else
171-
test-all-failed := 0
172-
endif
173-
174189
#
175190
# Special fast-path for the 'all features are available' case:
176191
#
@@ -180,15 +195,6 @@ $(call feature_check,all,$(MSG))
180195
# Just in case the build freshly failed, make sure we print the
181196
# feature matrix:
182197
#
183-
ifeq ($(feature-all), 0)
184-
test-all-failed := 1
185-
endif
186-
187-
ifeq ($(test-all-failed),1)
188-
$(info )
189-
$(info Auto-detecting system features:)
190-
endif
191-
192198
ifeq ($(feature-all), 1)
193199
#
194200
# test-all.c passed - just set all the core feature flags to 1:
@@ -199,27 +205,6 @@ else
199205
$(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_check,$(feat)))
200206
endif
201207

202-
#
203-
# Print the result of the feature test:
204-
#
205-
feature_print = $(eval $(feature_print_code)) $(info $(MSG))
206-
207-
define feature_print_code
208-
ifeq ($(feature-$(1)), 1)
209-
MSG = $(shell printf '...%30s: [ \033[32mon\033[m ]' $(1))
210-
else
211-
MSG = $(shell printf '...%30s: [ \033[31mOFF\033[m ]' $(1))
212-
endif
213-
endef
214-
215-
#
216-
# Only print out our features if we rebuilt the testcases or if a test failed:
217-
#
218-
ifeq ($(test-all-failed), 1)
219-
$(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_print,$(feat)))
220-
$(info )
221-
endif
222-
223208
ifeq ($(feature-stackprotector-all), 1)
224209
CFLAGS += -fstack-protector-all
225210
endif
@@ -602,3 +587,59 @@ ifdef DESTDIR
602587
plugindir=$(libdir)/traceevent/plugins
603588
plugindir_SQ= $(subst ','\'',$(plugindir))
604589
endif
590+
591+
#
592+
# Print the result of the feature test:
593+
#
594+
feature_print = $(eval $(feature_print_code)) $(info $(MSG))
595+
596+
define feature_print_code
597+
ifeq ($(feature-$(1)), 1)
598+
MSG = $(shell printf '...%30s: [ \033[32mon\033[m ]' $(1))
599+
else
600+
MSG = $(shell printf '...%30s: [ \033[31mOFF\033[m ]' $(1))
601+
endif
602+
endef
603+
604+
PERF_FEATURES := $(foreach feat,$(LIB_FEATURE_TESTS),feature-$(feat)($(feature-$(feat))))
605+
PERF_FEATURES_FILE := $(shell touch $(OUTPUT)PERF-FEATURES; cat $(OUTPUT)PERF-FEATURES)
606+
607+
# The $(display_lib) controls the default detection message
608+
# output. It's set if:
609+
# - detected features differes from stored features from
610+
# last build (in PERF-FEATURES file)
611+
# - one of the $(LIB_FEATURE_TESTS) is not detected
612+
# - VF is enabled
613+
614+
ifneq ("$(PERF_FEATURES)","$(PERF_FEATURES_FILE)")
615+
$(shell echo "$(PERF_FEATURES)" > $(OUTPUT)PERF-FEATURES)
616+
display_lib := 1
617+
endif
618+
619+
feature_check = $(eval $(feature_check_code))
620+
define feature_check_code
621+
ifneq ($(feature-$(1)), 1)
622+
display_lib := 1
623+
endif
624+
endef
625+
626+
$(foreach feat,$(LIB_FEATURE_TESTS),$(call feature_check,$(feat)))
627+
628+
ifeq ($(VF),1)
629+
display_lib := 1
630+
display_vf := 1
631+
endif
632+
633+
ifeq ($(display_lib),1)
634+
$(info )
635+
$(info Auto-detecting system features:)
636+
$(foreach feat,$(LIB_FEATURE_TESTS),$(call feature_print,$(feat),))
637+
endif
638+
639+
ifeq ($(display_vf),1)
640+
$(foreach feat,$(VF_FEATURE_TESTS),$(call feature_print,$(feat),))
641+
endif
642+
643+
ifeq ($(display_lib),1)
644+
$(info )
645+
endif

0 commit comments

Comments
 (0)