C++ Shell Makefile M4 C HTML CSS
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
base first commit Apr 4, 2014
gflags first commit Apr 4, 2014
glog Add configuration support to detect and use LLVM libraries. Mar 2, 2016
m4 m4/ax_llvm: Fix undefined `llvm::DisableABIBreakingChecks' error in L… Feb 5, 2018
symbolize Fix the bug where inline stack is not populated. Jul 27, 2017
third_party Add a git submodule for https://github.com/google/protobuf.git. Apr 6, 2018
.clang-format Add support for LLVM profiles. Apr 15, 2014
.gitignore gitignore: ignore generated files Feb 1, 2018
.gitmodules Add a git submodule for https://github.com/google/protobuf.git. Apr 6, 2018
AUTHORS first commit Apr 4, 2014
CONTRIBUTING first commit Apr 4, 2014
COPYING first commit Apr 4, 2014
ChangeLog first commit Apr 4, 2014
INSTALL autoconf: delete autogenerated files, add documentation on how to bui… Feb 1, 2018
LICENSE first commit Apr 4, 2014
Makefile.am Add a git submodule for https://github.com/google/protobuf.git. Apr 6, 2018
NEWS first commit Apr 4, 2014
README Add a git submodule for https://github.com/google/protobuf.git. Apr 6, 2018
addr2line.cc Fix the bug where inline stack is not populated. Jul 27, 2017
addr2line.h rebase the symbolizer code to have 2-level line table support, as wel… Jul 27, 2017
config.h.in Add missing config.h.in. Mar 4, 2016
configure.ac Add a git submodule for https://github.com/google/protobuf.git. Apr 6, 2018
create_gcov.cc Re-factor profile writer to separate LLVM and GCC writers. Mar 25, 2016
create_llvm_prof.cc m4/ax_llvm: update test to match new LLVM 5 discriminator support dep… Feb 2, 2018
dump_gcov.cc Rebase autofdo toolchain. Jul 27, 2017
gcov.cc Sync with google depot. Fix a bug in HasSuffixString. Jun 3, 2014
gcov.h Sync with google depot. Fix a bug in HasSuffixString. Jun 3, 2014
inc first commit Apr 4, 2014
instruction_map.cc first commit Apr 4, 2014
instruction_map.h first commit Apr 4, 2014
llvm_profile_writer.cc Rebase autofdo toolchain. Jul 27, 2017
llvm_profile_writer.h Re-factor profile writer to separate LLVM and GCC writers. Mar 25, 2016
module_grouper.cc Rebase autofdo toolchain. Jul 27, 2017
module_grouper.h Rebase autofdo toolchain. Jul 27, 2017
profile.cc Rebase autofdo toolchain. Jul 27, 2017
profile.h Performance and memory optimizations. Apr 24, 2014
profile_creator.cc Fix path truncation in profile_creator Sep 7, 2017
profile_creator.h Rebase autofdo toolchain. Jul 27, 2017
profile_diff.cc Rebase autofdo toolchain. Jul 27, 2017
profile_merger.cc Rebase autofdo toolchain. Jul 27, 2017
profile_reader.cc Rebase autofdo toolchain. Jul 27, 2017
profile_reader.h Rebase autofdo toolchain. Jul 27, 2017
profile_update.cc Rebase autofdo toolchain. Jul 27, 2017
profile_writer.cc Rebase autofdo toolchain. Jul 27, 2017
profile_writer.h Rebase autofdo toolchain. Jul 27, 2017
sample_merger.cc Add other profile tools: Apr 23, 2014
sample_reader.cc Replace the local clone of quipper with a git submodule of https://gi… Apr 6, 2018
sample_reader.h Sync to the head of google depot. Oct 22, 2014
source_info.cc first commit Apr 4, 2014
source_info.h Merge pull request #58 from marksantaniello/master Dec 13, 2017
symbol_map.cc Rebase autofdo toolchain. Jul 27, 2017
symbol_map.h Rebase autofdo toolchain. Jul 27, 2017

README

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.

Install dependencies:
	sudo apt-get -y install autoconf automake git libelf-dev libssl-dev pkg-config

Clone the repository using the following command:
	git clone --recursive https://github.com/google/autofdo.git

	Note: `--recursive` fetches https://github.com/google/perf_data_converter.git,
	which contains quipper, and https://github.com/google/protobuf.git.

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)
make -j$(nproc)

Usage:
./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" or "-g1". For LLVM, you alse need
to have -fdebug-info-for-profiling.

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.