Skip to content

DavidCallahan/autofdo

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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'. 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.

Usage:
make
./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
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"

Output:

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.

About

AutoFDO

Resources

License

Apache-2.0, Apache-2.0 licenses found

Licenses found

Apache-2.0
LICENSE
Apache-2.0
COPYING

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 64.4%
  • Shell 18.5%
  • Makefile 10.3%
  • C 2.2%
  • M4 2.2%
  • HTML 1.0%
  • Other 1.4%