aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorWang Nan <wangnan0@huawei.com>2016-01-13 07:17:14 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-01-15 14:31:59 -0500
commit7be43dfb1e617b87bf2d936d82c026be39b43910 (patch)
treeca3595a50c024aa1f26dfa5892867e8a1fbf8199 /tools
parent40c4a0f92aed570cc529a1e5c24c7e04a0ce8b85 (diff)
perf build: Set parallel making options build-test
'make build-test' is painful because of time consuming. In a full test, all test cases are built twice with tools/perf/Makefile and tools/perf/Makefile.perf. 'Makefile' automatically computes parallel options for make, but 'Makefile.perf' not, so all test cases is built with one job. It is very slow. This patch adds '-j' options to Makefile.perf testing. It computes parallel building options like what tools/perf/Makefile does, and pass '-j' option to Makefile.perf test. Signed-off-by: Wang Nan <wangnan0@huawei.com> Acked-by: Jiri Olsa <jolsa@kernel.org> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Zefan Li <lizefan@huawei.com> Cc: pi3orama@163.com Link: http://lkml.kernel.org/r/1452687442-6186-2-git-send-email-wangnan0@huawei.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/tests/make23
1 files changed, 16 insertions, 7 deletions
diff --git a/tools/perf/tests/make b/tools/perf/tests/make
index df38decc48c3..c0ee67906e0a 100644
--- a/tools/perf/tests/make
+++ b/tools/perf/tests/make
@@ -5,7 +5,7 @@ ifeq ($(MAKECMDGOALS),)
5# no target specified, trigger the whole suite 5# no target specified, trigger the whole suite
6all: 6all:
7 @echo "Testing Makefile"; $(MAKE) -sf tests/make MK=Makefile 7 @echo "Testing Makefile"; $(MAKE) -sf tests/make MK=Makefile
8 @echo "Testing Makefile.perf"; $(MAKE) -sf tests/make MK=Makefile.perf 8 @echo "Testing Makefile.perf"; $(MAKE) -sf tests/make MK=Makefile.perf SET_PARALLEL=1
9else 9else
10# run only specific test over 'Makefile' 10# run only specific test over 'Makefile'
11%: 11%:
@@ -14,6 +14,15 @@ endif
14else 14else
15PERF := . 15PERF := .
16 16
17PARALLEL_OPT=
18ifeq ($(SET_PARALLEL),1)
19 cores := $(shell (getconf _NPROCESSORS_ONLN || egrep -c '^processor|^CPU[0-9]' /proc/cpuinfo) 2>/dev/null)
20 ifeq ($(cores),0)
21 cores := 1
22 endif
23 PARALLEL_OPT="-j$(cores)"
24endif
25
17# As per kernel Makefile, avoid funny character set dependencies 26# As per kernel Makefile, avoid funny character set dependencies
18unexport LC_ALL 27unexport LC_ALL
19LC_COLLATE=C 28LC_COLLATE=C
@@ -252,7 +261,7 @@ clean := @(cd $(PERF); make -s -f $(MK) clean >/dev/null)
252$(run): 261$(run):
253 $(call clean) 262 $(call clean)
254 @TMP_DEST=$$(mktemp -d); \ 263 @TMP_DEST=$$(mktemp -d); \
255 cmd="cd $(PERF) && make -f $(MK) DESTDIR=$$TMP_DEST $($@)"; \ 264 cmd="cd $(PERF) && make -f $(MK) $(PARALLEL_OPT) DESTDIR=$$TMP_DEST $($@)"; \
256 echo "- $@: $$cmd" && echo $$cmd > $@ && \ 265 echo "- $@: $$cmd" && echo $$cmd > $@ && \
257 ( eval $$cmd ) >> $@ 2>&1; \ 266 ( eval $$cmd ) >> $@ 2>&1; \
258 echo " test: $(call test,$@)" >> $@ 2>&1; \ 267 echo " test: $(call test,$@)" >> $@ 2>&1; \
@@ -263,7 +272,7 @@ $(run_O):
263 $(call clean) 272 $(call clean)
264 @TMP_O=$$(mktemp -d); \ 273 @TMP_O=$$(mktemp -d); \
265 TMP_DEST=$$(mktemp -d); \ 274 TMP_DEST=$$(mktemp -d); \
266 cmd="cd $(PERF) && make -f $(MK) O=$$TMP_O DESTDIR=$$TMP_DEST $($(patsubst %_O,%,$@))"; \ 275 cmd="cd $(PERF) && make -f $(MK) $(PARALLEL_OPT) O=$$TMP_O DESTDIR=$$TMP_DEST $($(patsubst %_O,%,$@))"; \
267 echo "- $@: $$cmd" && echo $$cmd > $@ && \ 276 echo "- $@: $$cmd" && echo $$cmd > $@ && \
268 ( eval $$cmd ) >> $@ 2>&1 && \ 277 ( eval $$cmd ) >> $@ 2>&1 && \
269 echo " test: $(call test_O,$@)" >> $@ 2>&1; \ 278 echo " test: $(call test_O,$@)" >> $@ 2>&1; \
@@ -277,15 +286,15 @@ tarpkg:
277 rm -f $@ 286 rm -f $@
278 287
279make_kernelsrc: 288make_kernelsrc:
280 @echo "- make -C <kernelsrc> tools/perf" 289 @echo "- make -C <kernelsrc> $(PARALLEL_OPT) tools/perf"
281 $(call clean); \ 290 $(call clean); \
282 (make -C ../.. tools/perf) > $@ 2>&1 && \ 291 (make -C ../.. $(PARALLEL_OPT) tools/perf) > $@ 2>&1 && \
283 test -x perf && rm -f $@ || (cat $@ ; false) 292 test -x perf && rm -f $@ || (cat $@ ; false)
284 293
285make_kernelsrc_tools: 294make_kernelsrc_tools:
286 @echo "- make -C <kernelsrc>/tools perf" 295 @echo "- make -C <kernelsrc>/tools $(PARALLEL_OPT) perf"
287 $(call clean); \ 296 $(call clean); \
288 (make -C ../../tools perf) > $@ 2>&1 && \ 297 (make -C ../../tools $(PARALLEL_OPT) perf) > $@ 2>&1 && \
289 test -x perf && rm -f $@ || (cat $@ ; false) 298 test -x perf && rm -f $@ || (cat $@ ; false)
290 299
291all: $(run) $(run_O) tarpkg make_kernelsrc make_kernelsrc_tools 300all: $(run) $(run_O) tarpkg make_kernelsrc make_kernelsrc_tools