linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: tip-bot for Ingo Molnar <mingo@kernel.org>
To: linux-tip-commits@vger.kernel.org
Cc: acme@redhat.com, linux-kernel@vger.kernel.org, paulus@samba.org,
	hpa@zytor.com, mingo@kernel.org, a.p.zijlstra@chello.nl,
	eranian@gmail.com, namhyung@kernel.org, bp@amd64.org,
	avagin@openvz.org, jolsa@redhat.com, dhowells@redhat.com,
	fweisbec@gmail.com, rostedt@goodmis.org, tglx@linutronix.de
Subject: [tip:perf/core] perf tools: Speed up the perf build time by simplifying the perf --version string generation
Date: Tue, 13 Nov 2012 22:32:09 -0800	[thread overview]
Message-ID: <tip-acddedfba0df1e47fa99035a04661082b679ee9c@git.kernel.org> (raw)
In-Reply-To: <20121030084600.GB8245@gmail.com>

Commit-ID:  acddedfba0df1e47fa99035a04661082b679ee9c
Gitweb:     http://git.kernel.org/tip/acddedfba0df1e47fa99035a04661082b679ee9c
Author:     Ingo Molnar <mingo@kernel.org>
AuthorDate: Tue, 30 Oct 2012 09:46:00 +0100
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 31 Oct 2012 12:17:49 -0200

perf tools: Speed up the perf build time by simplifying the perf --version string generation

Building perf is pretty slow on trees that have a lot of commits
relative to the nearest Git tag. This slowness manifests itself during
version string generation:

 $ perf stat --null --repeat 3 --sync --pre "rm -f PERF-VERSION-FILE" util/PERF-VERSION-GEN
 PERF_VERSION = 3.7.rc3.1458.g5399b3b
 PERF_VERSION = 3.7.rc3.1458.g5399b3b
 PERF_VERSION = 3.7.rc3.1458.g5399b3b

 Performance counter stats for 'util/PERF-VERSION-GEN' (3 runs):

       2.857503976 seconds time elapsed                                          ( +-  0.22% )

The build can be even slower than that, when one over NFS volumes.

The reason for the slowness is that util/PERF-VERSION-GEN uses "git
describe" to generate the string, which has to count the "number of
commits distance" from the nearest tag - the ".1458." count in the
output above. For that Git had to extract and decompress 1458 Git
objects, which takes time and bandwidth.

But this "number of commits" value is mostly irrelevant in practice. We
either want to know an approximate tag name, or we want to know the
precise sha1.

So this patch simplifies the version string to:

 PERF_VERSION = 3.7.rc3.g5399b3b.dirty

which speeds up the version string generation script by an order of
magnitude:

 $ perf stat --null --repeat 3 --sync --pre "rm -f PERF-VERSION-FILE" util/PERF-VERSION-GEN
 PERF_VERSION = 3.7.rc3.g5399b3b.dirty
 PERF_VERSION = 3.7.rc3.g5399b3b.dirty
 PERF_VERSION = 3.7.rc3.g5399b3b.dirty

 Performance counter stats for 'util/PERF-VERSION-GEN' (3 runs):

       0.307633559 seconds time elapsed                                          ( +-  0.84% )

Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Andrew Vagin <avagin@openvz.org>
Cc: Borislav Petkov <bp@amd64.org>
Cc: David Howells <dhowells@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/20121030084600.GB8245@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/PERF-VERSION-GEN |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/perf/util/PERF-VERSION-GEN b/tools/perf/util/PERF-VERSION-GEN
index 95264f3..f6e8ee2 100755
--- a/tools/perf/util/PERF-VERSION-GEN
+++ b/tools/perf/util/PERF-VERSION-GEN
@@ -12,7 +12,7 @@ LF='
 # First check if there is a .git to get the version from git describe
 # otherwise try to get the version from the kernel makefile
 if test -d ../../.git -o -f ../../.git &&
-	VN=$(git describe --match 'v[0-9].[0-9]*' --abbrev=4 HEAD 2>/dev/null) &&
+	VN=$(echo $(git tag -l "v[0-9].[0-9]*" | tail -1)"-g"$(git log -1 --abbrev=4 --pretty=format:"%h" HEAD) 2>/dev/null) &&
 	case "$VN" in
 	*$LF*) (exit 1) ;;
 	v[0-9]*)

  parent reply	other threads:[~2012-11-14  6:33 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-26 14:31 [GIT PULL 0/9] perf/core improvements and fixes Arnaldo Carvalho de Melo
2012-10-26 14:31 ` [PATCH 1/9] tools lib traceevent: Do not generate dependency for system header files Arnaldo Carvalho de Melo
2012-10-26 14:31 ` [PATCH 2/9] perf tools: Cleanup doc related targets Arnaldo Carvalho de Melo
2012-10-26 14:31 ` [PATCH 3/9] perf tools: Convert invocation of MAKE into SUBDIR Arnaldo Carvalho de Melo
2012-10-26 14:31 ` [PATCH 4/9] perf tools: Always show CHK message when doing try-cc Arnaldo Carvalho de Melo
2012-10-26 14:31 ` [PATCH 5/9] perf tools: Fix LIBELF_MMAP checking Arnaldo Carvalho de Melo
2012-10-26 14:31 ` [PATCH 6/9] perf inject: Work with files Arnaldo Carvalho de Melo
2012-10-26 14:31 ` [PATCH 7/9] perf inject: Merge sched_stat_* and sched_switch events Arnaldo Carvalho de Melo
2012-10-26 14:31 ` [PATCH 8/9] perf inject: Mark a dso if it's used Arnaldo Carvalho de Melo
2012-10-26 14:31 ` [PATCH 9/9] perf stat: Add --pre and --post command Arnaldo Carvalho de Melo
2012-10-26 14:54 ` [GIT PULL 0/9] perf/core improvements and fixes Ingo Molnar
2012-10-26 15:06   ` David Ahern
2012-10-26 15:31     ` Namhyung Kim
2012-10-26 15:34       ` Borislav Petkov
2012-10-26 16:31         ` Arnaldo Carvalho de Melo
2012-10-26 17:20           ` Borislav Petkov
2012-10-27  9:16             ` Namhyung Kim
2012-10-27 14:29               ` Arnaldo Carvalho de Melo
2012-10-27 17:12       ` stephane eranian
2012-10-27 13:33     ` 'git describe' is very slow on development trees with lots of commits Ingo Molnar
2012-10-31 17:52       ` Pavel Machek
2012-10-26 17:05   ` [GIT PULL 0/9] perf/core improvements and fixes Arnaldo Carvalho de Melo
2012-10-27 13:19     ` Ingo Molnar
2012-10-30  8:18       ` Ingo Molnar
2012-10-30  8:21         ` Peter Zijlstra
2012-10-30  9:14           ` Ingo Molnar
2012-10-30  8:46         ` [PATCH] perf tools: Speed up the perf build time by simplifying the perf --version string generation Ingo Molnar
2012-10-30  9:35           ` Arnaldo Carvalho de Melo
2012-10-30  9:43             ` Ingo Molnar
2012-10-30  9:48               ` Ingo Molnar
2012-10-30  9:57                 ` Arnaldo Carvalho de Melo
2012-10-30 10:01                   ` Ingo Molnar
2012-10-30  9:49               ` Arnaldo Carvalho de Melo
2012-11-14  6:32           ` tip-bot for Ingo Molnar [this message]
2012-10-30  8:54         ` [PATCH] perf tools: Further speed up the perf build Ingo Molnar
2012-11-14  6:33           ` [tip:perf/core] " tip-bot for 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=tip-acddedfba0df1e47fa99035a04661082b679ee9c@git.kernel.org \
    --to=mingo@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=avagin@openvz.org \
    --cc=bp@amd64.org \
    --cc=dhowells@redhat.com \
    --cc=eranian@gmail.com \
    --cc=fweisbec@gmail.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=namhyung@kernel.org \
    --cc=paulus@samba.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).