aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/Makefile
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2013-10-01 10:28:09 -0400
committerIngo Molnar <mingo@kernel.org>2013-10-09 02:48:50 -0400
commitc72e3f04b45fb2e50cdd81a50c3778c6a57251d8 (patch)
treea979d8133d94081d0f8daee075431ecacacf3007 /tools/perf/Makefile
parentbaa9c30e1e250abf3e53b98e5bcf415dccdc7ba2 (diff)
tools/perf/build: Speed up git-version test on re-make
util/PERF-VERSION-GEN is currently executed on every build attempt, and this script can take a lot of time on trees that are at a significant git-distance from Linus's tree: $ time util/PERF-VERSION-GEN real 0m4.343s user 0m4.176s sys 0m0.140s It also takes a lot of time if the Git repository is network attached, etc., because the commands it uses: TAG=$(git describe --abbrev=0 --match "v[0-9].[0-9]*" 2>/dev/null ) has to count commits from the nearest tag and thus has to access (and decompress) every git commit blob on the relevant version path. Even on Linus's tree it takes 0.28 seconds on a fast box to count all the commits and get the git version string: $ time util/PERF-VERSION-GEN real 0m0.279s user 0m0.247s sys 0m0.025s But the version string only has to be regenerated if the git repository's head commit changes. So add a dependency of ../../.git/HEAD and touch the file every time it's regenerated, so that Make's build rules can pick it up and cache the result: make: `PERF-VERSION-FILE' is up to date. real 0m0.184s user 0m0.117s sys 0m0.026s Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Namhyung Kim <namhyung@kernel.org> Cc: David Ahern <dsahern@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Link: http://lkml.kernel.org/n/tip-wvmlrurufuk6mo1ovtNigguT@git.kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/perf/Makefile')
-rw-r--r--tools/perf/Makefile15
1 files changed, 13 insertions, 2 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 64c043b7a438..6b5452a120af 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -70,8 +70,9 @@ ifneq ($(OUTPUT),)
70#$(info Determined 'OUTPUT' to be $(OUTPUT)) 70#$(info Determined 'OUTPUT' to be $(OUTPUT))
71endif 71endif
72 72
73$(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE 73$(OUTPUT)PERF-VERSION-FILE: ../../.git/HEAD
74 @$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT) 74 @$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT)
75 @touch $(OUTPUT)PERF-VERSION-FILE
75 76
76CC = $(CROSS_COMPILE)gcc 77CC = $(CROSS_COMPILE)gcc
77AR = $(CROSS_COMPILE)ar 78AR = $(CROSS_COMPILE)ar
@@ -814,6 +815,16 @@ clean: $(LIBTRACEEVENT)-clean $(LIBLK)-clean
814 $(RM) $(OUTPUT)util/*-flex* 815 $(RM) $(OUTPUT)util/*-flex*
815 $(python-clean) 816 $(python-clean)
816 817
818#
819# Trick: if ../../.git does not exist - we are building out of tree for example,
820# then force version regeneration:
821#
822ifeq ($(wildcard ../../.git/HEAD),)
823 GIT-HEAD-PHONY = ../../.git/HEAD
824else
825 GIT-HEAD-PHONY =
826endif
827
817.PHONY: all install clean strip $(LIBTRACEEVENT) $(LIBLK) 828.PHONY: all install clean strip $(LIBTRACEEVENT) $(LIBLK)
818.PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell 829.PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
819.PHONY: .FORCE-PERF-VERSION-FILE TAGS tags cscope .FORCE-PERF-CFLAGS 830.PHONY: $(GIT-HEAD-PHONY) TAGS tags cscope .FORCE-PERF-CFLAGS