Re: [PATCH 4/6] perf tools: Set parallel making options build-test
From: Jiri Olsa
Date: Mon Jan 11 2016 - 04:39:31 EST
On Fri, Jan 08, 2016 at 02:23:59PM +0000, Wang Nan wrote:
> '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@xxxxxxxxxx>
> Cc: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
> Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
> Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
> ---
> tools/perf/tests/make | 23 ++++++++++++++++-------
> 1 file changed, 16 insertions(+), 7 deletions(-)
>
> diff --git a/tools/perf/tests/make b/tools/perf/tests/make
> index 130be7c..bd9c61a 100644
> --- a/tools/perf/tests/make
> +++ b/tools/perf/tests/make
> @@ -3,7 +3,7 @@ ifeq ($(MAKECMDGOALS),)
> # no target specified, trigger the whole suite
> all:
> @echo "Testing Makefile"; $(MAKE) -sf tests/make MK=Makefile
> - @echo "Testing Makefile.perf"; $(MAKE) -sf tests/make MK=Makefile.perf
> + @echo "Testing Makefile.perf"; $(MAKE) -sf tests/make MK=Makefile.perf SET_PARALLEL=1
> else
> # run only specific test over 'Makefile'
> %:
> @@ -12,6 +12,15 @@ endif
> else
> PERF := .
>
> +PARALLEL_OPT=
> +ifeq ($(SET_PARALLEL),1)
> + cores := $(shell (getconf _NPROCESSORS_ONLN || egrep -c '^processor|^CPU[0-9]' /proc/cpuinfo) 2>/dev/null)
> + ifeq ($(cores),0)
> + cores := 1
> + endif
> + PARALLEL_OPT="-j$(cores)"
> +endif
we could share this with Makefile, but there's probably no point to librarize single line ATM
Acked-by: Jiri Olsa <jolsa@xxxxxxxxxx>
thanks,
jirka