Skip to content

Commit

Permalink
Added script to run benches with PGO
Browse files Browse the repository at this point in the history
  • Loading branch information
mappum committed Aug 22, 2019
1 parent 7ddda37 commit 33388a2
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions scripts/pgo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

default_host_triple=""
default_toolchain=""
IFS=" = "
while read -r name value
do
value="${value//\"/}"
if [ "${name}" == "default_host_triple" ]; then
default_host_triple="${value}"
elif [ "${name}" == "default_toolchain" ]; then
default_toolchain="${value}"
fi
done < ~/.rustup/settings.toml

echo "default_host_triple=${default_host_triple}"
echo "default_toolchain=${default_toolchain}"

rustup component add llvm-tools-preview

rm -rf /tmp/merk-pgo
RUSTFLAGS="-Cprofile-generate=/tmp/merk-pgo" cargo bench rand_rocks
~/.rustup/toolchains/${default_toolchain}/lib/rustlib/${default_host_triple}/bin/llvm-profdata merge -o /tmp/merk-pgo/merged.profdata /tmp/merk-pgo
RUSTFLAGS="-Cprofile-use=/tmp/merk-pgo/merged.profdata" cargo bench

0 comments on commit 33388a2

Please sign in to comment.