diff options
author | Jiri Olsa <jolsa@redhat.com> | 2014-02-19 10:52:54 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-02-24 07:29:35 -0500 |
commit | 0695e57b9a6a5eb856a58cf488f715b3bb7366a0 (patch) | |
tree | f81a1ced06d06ca53d19844821a8b6904884b91f | |
parent | da237ed07c5144b0330a38b9b68be167231255d0 (diff) |
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>
-rw-r--r-- | tools/perf/Makefile.perf | 4 | ||||
-rw-r--r-- | tools/perf/config/Makefile | 123 |
2 files changed, 85 insertions, 42 deletions
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index 5fedd6946f32..bde91f8307ff 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf | |||
@@ -7,6 +7,8 @@ include config/utilities.mak | |||
7 | 7 | ||
8 | # Define V to have a more verbose compile. | 8 | # Define V to have a more verbose compile. |
9 | # | 9 | # |
10 | # Define VF to have a more verbose feature check output. | ||
11 | # | ||
10 | # Define O to save output files in a separate directory. | 12 | # Define O to save output files in a separate directory. |
11 | # | 13 | # |
12 | # Define ARCH as name of target architecture if you want cross-builds. | 14 | # Define ARCH as name of target architecture if you want cross-builds. |
@@ -897,7 +899,7 @@ config-clean: | |||
897 | clean: $(LIBTRACEEVENT)-clean $(LIBAPIKFS)-clean config-clean | 899 | clean: $(LIBTRACEEVENT)-clean $(LIBAPIKFS)-clean config-clean |
898 | $(call QUIET_CLEAN, core-objs) $(RM) $(LIB_OBJS) $(BUILTIN_OBJS) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf.o $(LANG_BINDINGS) $(GTK_OBJS) | 900 | $(call QUIET_CLEAN, core-objs) $(RM) $(LIB_OBJS) $(BUILTIN_OBJS) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf.o $(LANG_BINDINGS) $(GTK_OBJS) |
899 | $(call QUIET_CLEAN, core-progs) $(RM) $(ALL_PROGRAMS) perf | 901 | $(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* |
901 | $(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean | 903 | $(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean |
902 | $(python-clean) | 904 | $(python-clean) |
903 | 905 | ||
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile index 1686583ff7fc..39e6e6cca8ed 100644 --- a/tools/perf/config/Makefile +++ b/tools/perf/config/Makefile | |||
@@ -149,6 +149,32 @@ CORE_FEATURE_TESTS = \ | |||
149 | stackprotector-all \ | 149 | stackprotector-all \ |
150 | timerfd | 150 | timerfd |
151 | 151 | ||
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 | |||
152 | # Set FEATURE_CHECK_(C|LD)FLAGS-all for all CORE_FEATURE_TESTS features. | 178 | # Set FEATURE_CHECK_(C|LD)FLAGS-all for all CORE_FEATURE_TESTS features. |
153 | # If in the future we need per-feature checks/flags for features not | 179 | # If in the future we need per-feature checks/flags for features not |
154 | # mentioned in this list we need to refactor this ;-). | 180 | # mentioned in this list we need to refactor this ;-). |
@@ -161,17 +187,6 @@ endef | |||
161 | $(foreach feat,$(CORE_FEATURE_TESTS),$(call set_test_all_flags,$(feat))) | 187 | $(foreach feat,$(CORE_FEATURE_TESTS),$(call set_test_all_flags,$(feat))) |
162 | 188 | ||
163 | # | 189 | # |
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 | |||
174 | # | ||
175 | # Special fast-path for the 'all features are available' case: | 190 | # Special fast-path for the 'all features are available' case: |
176 | # | 191 | # |
177 | $(call feature_check,all,$(MSG)) | 192 | $(call feature_check,all,$(MSG)) |
@@ -180,15 +195,6 @@ $(call feature_check,all,$(MSG)) | |||
180 | # Just in case the build freshly failed, make sure we print the | 195 | # Just in case the build freshly failed, make sure we print the |
181 | # feature matrix: | 196 | # feature matrix: |
182 | # | 197 | # |
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 | |||
192 | ifeq ($(feature-all), 1) | 198 | ifeq ($(feature-all), 1) |
193 | # | 199 | # |
194 | # test-all.c passed - just set all the core feature flags to 1: | 200 | # test-all.c passed - just set all the core feature flags to 1: |
@@ -199,27 +205,6 @@ else | |||
199 | $(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_check,$(feat))) | 205 | $(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_check,$(feat))) |
200 | endif | 206 | endif |
201 | 207 | ||
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 | |||
223 | ifeq ($(feature-stackprotector-all), 1) | 208 | ifeq ($(feature-stackprotector-all), 1) |
224 | CFLAGS += -fstack-protector-all | 209 | CFLAGS += -fstack-protector-all |
225 | endif | 210 | endif |
@@ -602,3 +587,59 @@ ifdef DESTDIR | |||
602 | plugindir=$(libdir)/traceevent/plugins | 587 | plugindir=$(libdir)/traceevent/plugins |
603 | plugindir_SQ= $(subst ','\'',$(plugindir)) | 588 | plugindir_SQ= $(subst ','\'',$(plugindir)) |
604 | endif | 589 | 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 | ||