Skip to content

Commit

Permalink
Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux…
Browse files Browse the repository at this point in the history
…/kernel/git/acme/linux into perf/core

Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:

 * Handle PERF_RECORD_EXIT events in sched and annotate.

 * struct machine refactorings to help in top and trace.

 * Add on_exit implementation for systems without one, e.g. Android, from
   Bernhard Rosenkraenzer.

 * Only process events for vcpus of interest, helps handling large number
   of events, from David Ahern.

 * Cross compilation fixes for Android, from Irina Tirdea.

 * Add documentation on compiling for Android, from Irina Tirdea.

 * perf diff improvements from Jiri Olsa.

 * Target (task/user/cpu/syswide) handling improvements, from Namhyung Kim.

 * Add support in 'trace' for tracing workload given by command line, from
   Namhyung Kim.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
  • Loading branch information
Ingo Molnar committed Oct 9, 2012
2 parents 1d787d3 + 7747e2f commit 6fcdb1e
Show file tree
Hide file tree
Showing 62 changed files with 2,348 additions and 1,462 deletions.
75 changes: 75 additions & 0 deletions tools/perf/Documentation/android.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
How to compile perf for Android
=========================================

I. Set the Android NDK environment
------------------------------------------------

(a). Use the Android NDK
------------------------------------------------
1. You need to download and install the Android Native Development Kit (NDK).
Set the NDK variable to point to the path where you installed the NDK:
export NDK=/path/to/android-ndk

2. Set cross-compiling environment variables for NDK toolchain and sysroot.
For arm:
export NDK_TOOLCHAIN=${NDK}/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/arm-linux-androideabi-
export NDK_SYSROOT=${NDK}/platforms/android-9/arch-arm
For x86:
export NDK_TOOLCHAIN=${NDK}/toolchains/x86-4.6/prebuilt/linux-x86/bin/i686-linux-android-
export NDK_SYSROOT=${NDK}/platforms/android-9/arch-x86

This method is not working for Android NDK versions up to Revision 8b.
perf uses some bionic enhancements that are not included in these NDK versions.
You can use method (b) described below instead.

(b). Use the Android source tree
-----------------------------------------------
1. Download the master branch of the Android source tree.
Set the environment for the target you want using:
source build/envsetup.sh
lunch

2. Build your own NDK sysroot to contain latest bionic changes and set the
NDK sysroot environment variable.
cd ${ANDROID_BUILD_TOP}/ndk
For arm:
./build/tools/build-ndk-sysroot.sh --abi=arm
export NDK_SYSROOT=${ANDROID_BUILD_TOP}/ndk/build/platforms/android-3/arch-arm
For x86:
./build/tools/build-ndk-sysroot.sh --abi=x86
export NDK_SYSROOT=${ANDROID_BUILD_TOP}/ndk/build/platforms/android-3/arch-x86

3. Set the NDK toolchain environment variable.
For arm:
export NDK_TOOLCHAIN=${ANDROID_TOOLCHAIN}/arm-linux-androideabi-
For x86:
export NDK_TOOLCHAIN=${ANDROID_TOOLCHAIN}/i686-linux-android-

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}"

III. Install perf
-----------------------------------------------
You need to connect to your Android device/emulator using adb.
Install perf using:
adb push perf /data/perf

If you also want to use perf-archive you need busybox tools for Android.
For installing perf-archive, you first need to replace #!/bin/bash with #!/system/bin/sh:
sed 's/#!\/bin\/bash/#!\/system\/bin\/sh/g' perf-archive >> /tmp/perf-archive
chmod +x /tmp/perf-archive
adb push /tmp/perf-archive /data/perf-archive

IV. Environment settings for running perf
------------------------------------------------
Some perf features need environment variables to run properly.
You need to set these before running perf on the target:
adb shell
# PERF_PAGER=cat

IV. Run perf
------------------------------------------------
Run perf on your device/emulator to which you previously connected using adb:
# ./data/perf
60 changes: 60 additions & 0 deletions tools/perf/Documentation/perf-diff.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,66 @@ OPTIONS
--symfs=<directory>::
Look for files with symbols relative to this directory.

-b::
--baseline-only::
Show only items with match in baseline.

-c::
--compute::
Differential computation selection - delta,ratio,wdiff (default is delta).
If '+' is specified as a first character, the output is sorted based
on the computation results.
See COMPARISON METHODS section for more info.

-p::
--period::
Show period values for both compared hist entries.

-F::
--formula::
Show formula for given computation.

COMPARISON METHODS
------------------
delta
~~~~~
If specified the 'Delta' column is displayed with value 'd' computed as:

d = A->period_percent - B->period_percent

with:
- A/B being matching hist entry from first/second file specified
(or perf.data/perf.data.old) respectively.

- period_percent being the % of the hist entry period value within
single data file

ratio
~~~~~
If specified the 'Ratio' column is displayed with value 'r' computed as:

r = A->period / B->period

with:
- A/B being matching hist entry from first/second file specified
(or perf.data/perf.data.old) respectively.

- period being the hist entry period value

wdiff
~~~~~
If specified the 'Weighted diff' column is displayed with value 'd' computed as:

d = B->period * WEIGHT-A - A->period * WEIGHT-B

- A/B being matching hist entry from first/second file specified
(or perf.data/perf.data.old) respectively.

- period being the hist entry period value

- WEIGHT-A/WEIGHT-B being user suplied weights in the the '-c' option
behind ':' separator like '-c wdiff:1,2'.

SEE ALSO
--------
linkperf:perf-record[1]
Loading

0 comments on commit 6fcdb1e

Please sign in to comment.