Giter VIP home page Giter VIP logo

perf's Introduction

perf

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.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi- export NDK_SYSROOT=${NDK}/platforms/android-24/arch-arm For x86: export NDK_TOOLCHAIN=${NDK}/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/i686-linux-android- export NDK_SYSROOT=${NDK}/platforms/android-24/arch-x86

This method is only tested for Android NDK versions Revision 11b and later. perf uses some bionic enhancements that are not included in prior 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: For arm: make WERROR=0 ARCH=arm CROSS_COMPILE=${NDK_TOOLCHAIN} EXTRA_CFLAGS="-pie --sysroot=${NDK_SYSROOT}" For x86: make WERROR=0 ARCH=x86 CROSS_COMPILE=${NDK_TOOLCHAIN} EXTRA_CFLAGS="-pie --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

perf's People

Contributors

acmel avatar olsajiri avatar namhyung avatar ahunter6 avatar wangnan0 avatar mhiramathitachi avatar dsahern avatar fweisbec avatar torvalds avatar taeung avatar zanussi avatar kliang2 avatar mhiramat avatar artagnon avatar antonblanchard avatar codyps avatar ftang1 avatar milianw avatar dzickusrh avatar jpoimboe avatar rnav avatar zpp0 avatar itirdea avatar cphlipot avatar fbuihuu avatar fenrus75 avatar sbohrer avatar bwhacks avatar mathieupoirier avatar davem330 avatar

Watchers

Szilard Papp avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.