# STEP 0: Make sure there is no left-over profiling data from previous runs rm -rf /tmp/pgo-data # STEP 1: Build the instrumented binaries RUSTFLAGS="-Cprofile-generate=/tmp/pgo-data" \ cargo build --release --example computer --target=x86_64-unknown-linux-gnu # STEP 2: Run the instrumented binaries with some typical data ./target/x86_64-unknown-linux-gnu/release/examples/computer # STEP 3: Merge the `.profraw` files into a `.profdata` file llvm-profdata-11 merge -o /tmp/pgo-data/merged.profdata /tmp/pgo-data # STEP 4: Use the `.profdata` file for guiding optimizations RUSTFLAGS="-Cprofile-use=/tmp/pgo-data/merged.profdata" \ cargo build --release --example computer --target=x86_64-unknown-linux-gnu