All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Arnaldo Carvalho de Melo <acme@infradead.org>
Cc: linux-kernel@vger.kernel.org, Andrew Vagin <avagin@openvz.org>,
	Borislav Petkov <bp@amd64.org>,
	David Howells <dhowells@redhat.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
	Paul Mackerras <paulus@samba.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Stephane Eranian <eranian@gmail.com>,
	Steven Rostedt <rostedt@goodmis.org>
Subject: [PATCH] perf tools: Further speed up the perf build
Date: Tue, 30 Oct 2012 09:54:41 +0100	[thread overview]
Message-ID: <20121030085441.GC8245@gmail.com> (raw)
In-Reply-To: <20121030081807.GA8245@gmail.com>

There's another source of overhead in the perf version string 
generator:

   git update-index -q --refresh

... which will iterate the whole checked out tree. This can be 
pretty slow on NFS volumes, but takes some time even with local 
SSD disks and a fully cached kernel tree:

 $ perf stat --null --repeat 3 --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.306999221 seconds time elapsed                                          ( +-  0.56% )

So remove the .dirty differentiator as well - it adds little 
information because locally patched git trees are common, but 
seldom are the perf tools modified.

So a lot of version strings are reported as 'dirty' while in 
fact they are pristine perf builds. For example 99% of my perf 
builds are not patched but the kernel tree is slightly patched, 
which adds the .dirty tag.

Eliminating that tag speeds up version generation by another 
order of magnitude:

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

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

       0.021270923 seconds time elapsed                                          ( +-  1.94% )

(Also clean up some of the comments around this code.)

Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 tools/perf/util/PERF-VERSION-GEN | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/tools/perf/util/PERF-VERSION-GEN b/tools/perf/util/PERF-VERSION-GEN
index c774b89..6fb1cc8 100755
--- a/tools/perf/util/PERF-VERSION-GEN
+++ b/tools/perf/util/PERF-VERSION-GEN
@@ -9,17 +9,12 @@ GVF=${OUTPUT}PERF-VERSION-FILE
 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
+# otherwise try to get the version from the kernel Makefile
+#
 if test -d ../../.git -o -f ../../.git &&
-	VN=$(echo $(git tag --list "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]*)
-		git update-index -q --refresh
-		test -z "$(git diff-index --name-only HEAD --)" ||
-		VN="$VN-dirty" ;;
-	esac
+	VN=$(echo $(git tag --list "v[0-9].[0-9]*" | tail -1)"-g"$(git log -1 --abbrev=4 --pretty=format:"%h" HEAD) 2>/dev/null)
 then
 	VN=$(echo "$VN" | sed -e 's/-/./g');
 else

  parent reply	other threads:[~2012-10-30  8:54 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:perf/core] " tip-bot for Ingo Molnar
2012-10-30  8:54         ` Ingo Molnar [this message]
2012-11-14  6:33           ` [tip:perf/core] perf tools: Further speed up the perf build 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=20121030085441.GC8245@gmail.com \
    --to=mingo@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@infradead.org \
    --cc=avagin@openvz.org \
    --cc=bp@amd64.org \
    --cc=dhowells@redhat.com \
    --cc=eranian@gmail.com \
    --cc=fweisbec@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=namhyung@kernel.org \
    --cc=paulus@samba.org \
    --cc=rostedt@goodmis.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.