1 How to compile perf for Android 2 ========================================= 3 4 I. Set the Android NDK environment 5 ---------------------------------------------- 6 7 (a). Use the Android NDK 8 ---------------------------------------------- 9 1. You need to download and install the Androi 10 Set the NDK variable to point to the path wher 11 export NDK=/path/to/android-ndk 12 13 2. Set cross-compiling environment variables f 14 For arm: 15 export NDK_TOOLCHAIN=${NDK}/toolchains/arm-l 16 export NDK_SYSROOT=${NDK}/platforms/android- 17 For x86: 18 export NDK_TOOLCHAIN=${NDK}/toolchains/x86-4 19 export NDK_SYSROOT=${NDK}/platforms/android- 20 21 This method is only tested for Android NDK ver 22 perf uses some bionic enhancements that are no 23 You can use method (b) described below instead 24 25 (b). Use the Android source tree 26 ---------------------------------------------- 27 1. Download the master branch of the Android s 28 Set the environment for the target you want us 29 source build/envsetup.sh 30 lunch 31 32 2. Build your own NDK sysroot to contain lates 33 NDK sysroot environment variable. 34 cd ${ANDROID_BUILD_TOP}/ndk 35 For arm: 36 ./build/tools/build-ndk-sysroot.sh --abi=arm 37 export NDK_SYSROOT=${ANDROID_BUILD_TOP}/ndk/ 38 For x86: 39 ./build/tools/build-ndk-sysroot.sh --abi=x86 40 export NDK_SYSROOT=${ANDROID_BUILD_TOP}/ndk/ 41 42 3. Set the NDK toolchain environment variable. 43 For arm: 44 export NDK_TOOLCHAIN=${ANDROID_TOOLCHAIN}/ar 45 For x86: 46 export NDK_TOOLCHAIN=${ANDROID_TOOLCHAIN}/i6 47 48 II. Compile perf for Android 49 ---------------------------------------------- 50 You need to run make with the NDK toolchain an 51 For arm: 52 make WERROR=0 ARCH=arm CROSS_COMPILE=${NDK_T 53 For x86: 54 make WERROR=0 ARCH=x86 CROSS_COMPILE=${NDK_T 55 56 III. Install perf 57 ---------------------------------------------- 58 You need to connect to your Android device/emu 59 Install perf using: 60 adb push perf /data/perf 61 62 If you also want to use perf-archive you need 63 For installing perf-archive, you first need to 64 sed 's/#!\/bin\/bash/#!\/system\/bin\/sh/g' 65 chmod +x /tmp/perf-archive 66 adb push /tmp/perf-archive /data/perf-archiv 67 68 IV. Environment settings for running perf 69 ---------------------------------------------- 70 Some perf features need environment variables 71 You need to set these before running perf on t 72 adb shell 73 # PERF_PAGER=cat 74 75 IV. Run perf 76 ---------------------------------------------- 77 Run perf on your device/emulator to which you 78 # ./data/perf
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.