Skip to content

Latest commit

 

History

History
30 lines (20 loc) · 1.27 KB

File metadata and controls

30 lines (20 loc) · 1.27 KB

Profile Guided Optimization

Back{: .button}

# Compile with flag -fprofile-generate
gcc -omain main.c -O3 -fprofile-generate=<dir>

# Generate profile for the execution
./main

# Use the generated profile to optimize the binary
gcc -omain main.c -O3 -fprofile-use=<dir>

Note: The profiling build is run on multiple inputs to generate a profile that resembles the actual workload. Coverage with gprof is used to help with this step

Further Reading

Case Studies