- Apply the kernel patch (for Linux 3.13 and higher)
- Configure GCC (for x86_64) with the following options:
configure --program-prefix=k --enable-languages=c --enable-lto --disable-threads --disable-nls --disable-tls --disable-multiarch --disable-bootstrap --disable-werror --enable-cloog-backend=isl --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
- Configure the kernel (x86_64 config sample 3.13, 3.14) with:
CONFIG_GCOV_KERNEL=y
CONFIG_GCOV_PROFILE_ALL=y
- Build the instrumented kernel:
make CC=kgcc CFLAGS_GCOV=-fprofile-generate
- Run applications on the instrumented kernel
- Collect profile data with this script:
gather.sh profile.tar.gz
- Profile data processing
Profile data processing tool for GCC
4.7,
4.8,
4.9
Compile the profile data processing tool with g++ -o calcsum calcsum-4.?.cpp
Profile data processing command: process.sh profile.tar.gz
- Reconfigure the kernel with:
CONFIG_GCOV_KERNEL=n
CONFIG_GCOV_PROFILE_ALL=n
- Build the optimized kernel:
make clean
make CC=kgcc KCFLAGS="-fprofile-use -fprofile-correction -Wno-error=coverage-mismatch -fprofile-dir=/path/to/profile"