Giter Site home page Giter Site logo

gaybro8777 / autofdo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from google/autofdo

0.0 0.0 0.0 35.38 MB

AutoFDO

Home Page: https://groups.google.com/forum/#!forum/autofdo

License: Apache License 2.0

C++ 65.32% C 1.50% Makefile 6.76% Shell 21.91% CSS 0.13% HTML 1.39% M4 2.99%

autofdo's Introduction

Introduction

The repository contains a tool to convert perf.data profile to AutoFDO profile that can be used by GCC and LLVM.

Each compiler is supported by a different tool. For GCC, use create_gcov. For LLVM, use create_llvm_prof. LLVM version 5 or higher is required. The two tools have compatible command line flags. However, the outputs are incompatible. You cannot use the profile generated for GCC in LLVM and vice-versa.

Prerequisites to Build:

Install dependencies:

sudo apt-get -y install libtool autoconf automake git libelf-dev libssl-dev pkg-config

Clone & Compile

Clone the repository using the following command:

git clone --recursive https://github.com/google/autofdo.git

Note: --recursive fetches perf_data_converter, which contains quipper, and protobuf.

Full build instructions are in the INSTALL file, most can just install the above dependencies, and:

aclocal -I .; autoheader; autoconf; automake --add-missing -c
./configure # or --with-llvm=$(which llvm-config-5.0), for example
make -j 1

Note: do not use the -j to enable parallel build. The configure scripts for the sub-projects fail if run in parallel

Usage

Depending on your compiler, a perf dump can be collected by running one of:

./create_gcov --binary=BINARY --profile=PERF_PROFILE --gcov=OUTPUT
./create_llvm_prof --binary=BINARY --profile=PERF_PROFILE --out=OUTPUT

Inputs

--profile: PERF_PROFILE collected using linux perf (with last branch record). In order to collect this profile, you will need to have an Intel CPU that have last branch record (LBR) support. You also need to have your linux kernel configured with LBR support. To profile:

# perf record -c PERIOD -e EVENT -b -o perf.data -- ./command

Note: EVENT is refering to BR_INST_RETIRED:TAKEN if available. For some architectures, BR_INST_EXEC:TAKEN also works.

--binary: BINARY with debug info. You need to make sure the binary name is the same as the binary you run during profiling. Additionally, you will need to have debug info (i.e. line table) availabe in the binary. This means that you need to compile the binary with "-gmlt" or "-g1". For LLVM, you alse need to have -fdebug-info-for-profiling.

Outputs

For create_gcov: An AutoFDO profile in gcov format. To use the profile with AutoFDO, you need to use the google gcc branch (gcc.gnu.org/svn/gcc/branches/google/gcc-4_8), and pass the following flag to GCC: -fauto-profile=PROFILE_FILE

For create_llvm_prof: An AutoFDO profile in LLVM format. To use the profile with LLVM, you need to use the flag -fprofile-sample-use=PROFILE_FILE. This feature is available in LLVM 3.5 and later.

autofdo's People

Contributors

algrant-arm avatar danielboulby-arm avatar danielcdh avatar davidcallahan avatar dnovillo avatar gburgessiv avatar kim-phillips-arm avatar lannadorai avatar marksantaniello avatar mtrofin avatar ruijiefang avatar rwalkr avatar shenhanc78 avatar taewookoh avatar vapier avatar wmi-11 avatar wmi0 avatar zerodefect 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.