| #!/bin/bash |
| set -e |
| set -o pipefail |
| |
| # Build WebKit, run benchmarks, and spit out compressed PGO profiles |
| BASE=${1:-/Volumes/WebKit/BenchmarkProfiles/} |
| echo "Using output directory: $BASE" |
| |
| while true; do |
| read -p "Have you read the source of this script, and do you understand that it is potentially destructive? [y/N]" yn |
| case $yn in |
| [Yy]* ) break;; |
| [Nn]* ) exit;; |
| * ) echo "Please answer yes or no.";; |
| esac |
| done |
| |
| if [[ ! -d "$BASE" ]] ; then |
| echo "$BASE is missing, aborting." |
| exit |
| fi |
| |
| rm -rf "$BASE/*" |
| |
| mkdir -p "$BASE/speedometer" |
| mkdir -p "$BASE/jetstream" |
| mkdir -p "$BASE/motionmark" |
| mkdir -p "$BASE/output" |
| mkdir -p "$BASE/Internal/WebKit/WebKitAdditions/Profiling/" |
| |
| cd ../Internal |
| |
| rm -rf ../OpenSource/WebKitBuild |
| make release WK_LTO_MODE=thin ENABLE_LLVM_PROFILE_GENERATION=ON |
| |
| run-benchmark --plan jetstream2 --diagnose-directory="$BASE/jetstream" --generate-profiles --build-directory=../OpenSource/WebKitBuild/Release --count 1 |
| pgo-profile merge "$BASE/jetstream" |
| |
| run-benchmark --plan speedometer --diagnose-directory="$BASE/speedometer" --generate-profiles --build-directory=../OpenSource/WebKitBuild/Release --count 1 |
| pgo-profile merge "$BASE/speedometer" |
| |
| run-benchmark --plan motionmark --diagnose-directory="$BASE/motionmark" --generate-profiles --build-directory=../OpenSource/WebKitBuild/Release --count 1 |
| pgo-profile merge "$BASE/motionmark" |
| |
| rm *.result |
| |
| pgo-profile combine --jetstream "$BASE/jetstream" --speedometer "$BASE/speedometer" --motionmark "$BASE/motionmark" --output "$BASE/output" |
| |
| pgo-profile compress --input "$BASE/output" --output "$BASE/Internal/WebKit/WebKitAdditions/Profiling/" |
| |
| echo "Done! Find your profiles in $BASE/Internal/WebKit/WebKitAdditions/Profiling/" |
| echo "To check these in, do: 'cp -r $BASE/Internal/ ../Internal/'" |