From: Ingo Molnar <mingo@kernel.org>
To: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
David Ahern <dsahern@gmail.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Thomas Gleixner <tglx@linutronix.de>,
Andrew Morton <akpm@linux-foundation.org>,
Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@gmail.com>
Subject: [PATCH] perf tools: Speed up git-version test on re-make
Date: Tue, 1 Oct 2013 16:46:18 +0200 [thread overview]
Message-ID: <20131001144618.GA8970@gmail.com> (raw)
In-Reply-To: <20131001113456.GA31331@gmail.com>
Another build speedup, while at it.
===============>
Subject: perf tools: Speed up git-version test on re-make
From: Ingo Molnar <mingo@kernel.org>
Date: Tue Oct 1 16:28:09 CEST 2013
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
So the version generation overhead is completely gone for re-builds.
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
tools/perf/Makefile | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
Index: tip/tools/perf/Makefile
===================================================================
--- tip.orig/tools/perf/Makefile
+++ tip/tools/perf/Makefile
@@ -70,8 +70,9 @@ ifneq ($(OUTPUT),)
#$(info Determined 'OUTPUT' to be $(OUTPUT))
endif
-$(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE
+$(OUTPUT)PERF-VERSION-FILE: ../../.git/HEAD
@$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT)
+ @touch $(OUTPUT)PERF-VERSION-FILE
CC = $(CROSS_COMPILE)gcc
AR = $(CROSS_COMPILE)ar
@@ -813,7 +814,17 @@ clean: $(LIBTRACEEVENT)-clean $(LIBLK)-c
$(RM) $(OUTPUT)util/*-flex*
$(python-clean)
+#
+# Trick: if ../../.git does not exist - we are building out of tree for example,
+# then force version regeneration:
+#
+ifeq ($(wildcard ../../.git/HEAD),)
+ GIT-HEAD-PHONY = ../../.git/HEAD
+else
+ GIT-HEAD-PHONY =
+endif
+
.PHONY: all install clean strip $(LIBTRACEEVENT) $(LIBLK)
.PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
-.PHONY: .FORCE-PERF-VERSION-FILE TAGS tags cscope .FORCE-PERF-CFLAGS
+.PHONY: $(GIT-HEAD-PHONY) TAGS tags cscope .FORCE-PERF-CFLAGS
next prev parent reply other threads:[~2013-10-01 14:46 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-12 13:38 [GIT PULL] perf fixes Ingo Molnar
2013-09-12 18:03 ` Linus Torvalds
2013-09-12 18:10 ` Linus Torvalds
2013-09-12 18:43 ` Arnaldo Carvalho de Melo
2013-09-12 19:12 ` Arnaldo Carvalho de Melo
2013-09-12 19:13 ` Linus Torvalds
2013-09-12 19:55 ` Ingo Molnar
2013-09-12 19:58 ` David Ahern
2013-09-12 20:02 ` Arnaldo Carvalho de Melo
2013-09-12 20:31 ` Ingo Molnar
2013-09-12 20:43 ` Ingo Molnar
2013-09-15 9:10 ` [PATCH] perf test-hack: Split out feature tests to cache them and to build them in parallel Ingo Molnar
2013-09-30 16:42 ` [PATCH] perf auto-dep: Speed up feature tests by building " Ingo Molnar
2013-09-30 17:12 ` Arnaldo Carvalho de Melo
2013-09-30 17:27 ` Arnaldo Carvalho de Melo
2013-09-30 17:30 ` Arnaldo Carvalho de Melo
2013-09-30 17:36 ` Arnaldo Carvalho de Melo
2013-09-30 17:39 ` Arnaldo Carvalho de Melo
2013-09-30 17:46 ` Arnaldo Carvalho de Melo
2013-09-30 18:02 ` Arnaldo Carvalho de Melo
2013-09-30 19:15 ` Ingo Molnar
2013-09-30 19:09 ` Ingo Molnar
2013-09-30 17:34 ` Linus Torvalds
2013-09-30 17:53 ` Arnaldo Carvalho de Melo
2013-09-30 19:04 ` Ingo Molnar
2013-10-01 11:34 ` [PATCH] perf autodep: Remove strlcpy feature check, add __weak strlcpy implementation Ingo Molnar
2013-10-01 12:04 ` Ingo Molnar
2013-10-01 12:48 ` Arnaldo Carvalho de Melo
2013-10-01 12:51 ` [PATCH] perf autodep: Speed up the 'all features are present' case Ingo Molnar
2013-10-01 14:46 ` Ingo Molnar [this message]
2013-10-02 6:47 ` [PATCH] perf tools: Speed up git-version test on re-make Namhyung Kim
2013-10-02 6:50 ` Ingo Molnar
2013-10-02 8:04 ` Namhyung Kim
2013-10-01 15:27 ` [PATCH] perf autodep: Remove strlcpy feature check, add __weak strlcpy implementation Ingo Molnar
2013-10-01 15:29 ` [PATCH] perf tools: Speed up the final link Ingo Molnar
2013-10-01 7:04 ` [PATCH] perf auto-dep: Speed up feature tests by building them in parallel Geert Uytterhoeven
2013-10-01 8:38 ` Ingo Molnar
2013-10-02 6:05 ` Namhyung Kim
2013-10-02 6:28 ` Ingo Molnar
2013-10-02 9:26 ` Jiri Olsa
2013-10-02 10:11 ` Ingo Molnar
2013-09-12 20:18 ` [GIT PULL] perf fixes Ingo Molnar
2013-09-12 20:38 ` Arnaldo Carvalho de Melo
2013-09-12 20:46 ` Ingo Molnar
2013-09-12 21:09 ` David Ahern
2013-09-12 21:18 ` Ingo Molnar
2013-09-12 22:10 ` David Ahern
2013-09-13 5:09 ` Ingo Molnar
2013-09-13 9:32 ` Jean Pihet
2013-09-13 9:45 ` Ingo Molnar
2013-09-13 17:15 ` Jean Pihet
2013-09-12 18:51 ` Linus Torvalds
2013-09-12 20:33 ` Ingo Molnar
2013-09-12 20:38 ` Linus Torvalds
2013-09-12 20:49 ` Ingo Molnar
2013-09-12 20:52 ` Linus Torvalds
2013-09-12 21:01 ` Ingo Molnar
2013-09-12 20:10 ` Ingo Molnar
2013-10-02 7:31 ` [PATCH] tools/perf: Fix double/triple-build of the feature detection logic during 'make install' et al Ingo Molnar
2013-10-02 9:28 ` [PATCH] tools/perf/build: Automatically build in parallel, based on number of CPUs in the system Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131001144618.GA8970@gmail.com \
--to=mingo@kernel.org \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@ghostprotocols.net \
--cc=akpm@linux-foundation.org \
--cc=dsahern@gmail.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=namhyung@gmail.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.