Hi Ingo,
Please consider pulling,
- Arnaldo
The following changes since commit 95d18aa2b6c05351181934b3bc34ce038cc7b637:
perf/x86: Fix sparse warnings (2012-10-30 10:10:52 +0100)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux tags/perf-core-for-mingo
for you to fetch changes up to ffadcf090d468e9c4938b718649f38dd10cfdb02:
perf annotate: Handle XBEGIN like a jump (2012-10-31 12:18:26 -0200)
----------------------------------------------------------------
perf/core improvements and fixes
. Handle XBEGIN like a jump in the annotate browser, from Andi Kleen
. Build speedups for --version, from Ingo Molnar.
. Add info about cross compiling for Android ARM, from Joonsoo Kim.
. Warn about missing libelf, from Namhyung Kim.
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
----------------------------------------------------------------
Andi Kleen (1):
perf annotate: Handle XBEGIN like a jump
Arnaldo Carvalho de Melo (1):
perf tools: Handle --version string generation on machines without git
Ingo Molnar (2):
perf tools: Speed up the perf build time by simplifying the perf --version string generation
perf tools: Further speed up the perf build
Joonsoo Kim (1):
perf tools: Add info about cross compiling for Android ARM
Namhyung Kim (1):
perf tools: Warn about missing libelf
tools/perf/Documentation/android.txt | 5 ++++-
tools/perf/Makefile | 2 ++
tools/perf/util/PERF-VERSION-GEN | 14 +++++---------
tools/perf/util/annotate.c | 2 ++
4 files changed, 13 insertions(+), 10 deletions(-)
From: Joonsoo Kim <[email protected]>
Without defining ARCH=arm, building perf for Android ARM will fail,
because it needs architecture specific files.
So add related relevant information to the android documentation.
Signed-off-by: Joonsoo Kim <[email protected]>
Reviewed-by: Namhyung Kim <[email protected]>
Cc: David Ahern <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Irina Tirdea <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Pekka Enberg <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Steven Rostedt <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
tools/perf/Documentation/android.txt | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/tools/perf/Documentation/android.txt b/tools/perf/Documentation/android.txt
index a39dbbb..8484c3a 100644
--- a/tools/perf/Documentation/android.txt
+++ b/tools/perf/Documentation/android.txt
@@ -48,7 +48,10 @@ For x86:
II. Compile perf for Android
------------------------------------------------
You need to run make with the NDK toolchain and sysroot defined above:
- make CROSS_COMPILE=${NDK_TOOLCHAIN} CFLAGS="--sysroot=${NDK_SYSROOT}"
+For arm:
+ make ARCH=arm CROSS_COMPILE=${NDK_TOOLCHAIN} CFLAGS="--sysroot=${NDK_SYSROOT}"
+For x86:
+ make ARCH=x86 CROSS_COMPILE=${NDK_TOOLCHAIN} CFLAGS="--sysroot=${NDK_SYSROOT}"
III. Install perf
-----------------------------------------------
--
1.7.9.2.358.g22243
From: Ingo Molnar <[email protected]>
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 <[email protected]>
Cc: Andrew Vagin <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: David Howells <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Stephane Eranian <[email protected]>
Cc: Steven Rostedt <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
tools/perf/util/PERF-VERSION-GEN | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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]*)
--
1.7.9.2.358.g22243
From: Ingo Molnar <[email protected]>
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 <[email protected]>
Cc: Andrew Vagin <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: David Howells <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Stephane Eranian <[email protected]>
Cc: Steven Rostedt <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
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 f6e8ee2..ac418a1 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 -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]*)
- git update-index -q --refresh
- test -z "$(git diff-index --name-only HEAD --)" ||
- VN="$VN-dirty" ;;
- esac
+ 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)
then
VN=$(echo "$VN" | sed -e 's/-/./g');
else
--
1.7.9.2.358.g22243
From: Arnaldo Carvalho de Melo <[email protected]>
If git is installed we'll have a 'perf --version' output of this form:
$ make -j8 -C tools/perf/ O=/home/acme/git/build/perf install
$ perf --version
perf version 3.7.rc3.g3afad6
Now on a machine without git installed:
$ mv /home/acme/bin/git /home/acme/bin/git.OFF
$ make -j8 -C tools/perf/ O=/home/acme/git/build/perf install
$ perf --version
perf version 3.7.0-rc2
That is, no error message due to git not being installed will appear on the
screen and instead the version string in the top level Makefile will be
used.
Requested-by: Ingo Molnar <[email protected]>
Cc: David Ahern <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Mike Galbraith <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Stephane Eranian <[email protected]>
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
tools/perf/util/PERF-VERSION-GEN | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/perf/util/PERF-VERSION-GEN b/tools/perf/util/PERF-VERSION-GEN
index ac418a1..6aa34e5 100755
--- a/tools/perf/util/PERF-VERSION-GEN
+++ b/tools/perf/util/PERF-VERSION-GEN
@@ -14,8 +14,9 @@ LF='
# otherwise try to get the version from the kernel Makefile
#
if test -d ../../.git -o -f ../../.git &&
- 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)
+ VN=$(git tag 2>/dev/null | tail -1 | grep -E "v[0-9].[0-9]*")
then
+ VN=$(echo $VN"-g"$(git log -1 --abbrev=4 --pretty=format:"%h" HEAD))
VN=$(echo "$VN" | sed -e 's/-/./g');
else
VN=$(MAKEFLAGS= make -sC ../.. kernelversion)
--
1.7.9.2.358.g22243
From: Namhyung Kim <[email protected]>
When perf detects no libelf during the build, it'll use internal mini
elf parser instead of libelf. But as it only supports minimal
functionalities, it also disables support to 'probe' builtin command.
Currently it didn't warned to user. Fix it.
$ sudo apt-get remove libelf-dev
$ make
CHK -fstack-protector-all
CHK -Wstack-protector
CHK -Wvolatile-register-var
CHK bionic
CHK libelf
CHK glibc
Makefile:491: No libelf found, disables 'probe' tool, please install elfutils-libelf-devel/libelf-dev
CHK libunwind
CHK libaudit
$ make NO_LIBELF=1
CHK -fstack-protector-all
CHK -Wstack-protector
CHK -Wvolatile-register-var
CHK bionic
CHK libaudit
Reported-by: Peter Zijlstra <[email protected]>
Signed-off-by: Namhyung Kim <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Link: http://lkml.kernel.org/n/[email protected]
[ committer note: The package needed is elfutils-libelf-devel, not elfutils-devel ]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
tools/perf/Makefile | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 7e25f59..b1801e0 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -490,6 +490,8 @@ ifneq ($(call try-cc,$(SOURCE_LIBELF),$(FLAGS_LIBELF),libelf),y)
LIBC_SUPPORT := 1
endif
ifeq ($(LIBC_SUPPORT),1)
+ msg := $(warning No libelf found, disables 'probe' tool, please install elfutils-libelf-devel/libelf-dev);
+
NO_LIBELF := 1
NO_DWARF := 1
NO_DEMANGLE := 1
--
1.7.9.2.358.g22243
From: Andi Kleen <[email protected]>
So that the browser still shows the abort label.
Signed-off-by: Andi Kleen <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Stephane Eranian <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
tools/perf/util/annotate.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 7a34dd1..b14d4df 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -401,6 +401,8 @@ static struct ins instructions[] = {
{ .name = "testb", .ops = &mov_ops, },
{ .name = "testl", .ops = &mov_ops, },
{ .name = "xadd", .ops = &mov_ops, },
+ { .name = "xbeginl", .ops = &jump_ops, },
+ { .name = "xbeginq", .ops = &jump_ops, },
};
static int ins__cmp(const void *name, const void *insp)
--
1.7.9.2.358.g22243