From cc86591a6c1a765d252ba36075e6694ed4ff0652 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sun, 27 Aug 2023 17:02:12 -0400 Subject: [PATCH] Support the debug/dev profile in the perf script. --- scripts/perf.bash | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/scripts/perf.bash b/scripts/perf.bash index c7f9969a..11070240 100755 --- a/scripts/perf.bash +++ b/scripts/perf.bash @@ -8,11 +8,22 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" cd "$DIR/../" -cargo build --profile "$PROFILE" --no-default-features -perf record --freq=2000 --call-graph dwarf --output=perf.data target/${PROFILE}/compare -# Convert to a format firefox will read -# flags to consider --show-info -perf script -F +pid --input perf.data > perf.firefox +function main { + local additional_flags=() + if [ "$PROFILE" = "dev" ] || [ "$PROFILE" = "debug" ]; then + PROFILE="debug" + else + additional_flags+=(--profile "$PROFILE") + fi + cargo build --no-default-features "${additional_flags[@]}" + perf record --freq=2000 --call-graph dwarf --output=perf.data target/${PROFILE}/compare -echo "You probably want to go to https://profiler.firefox.com/" -echo "Either that or run hotspot" + # Convert to a format firefox will read + # flags to consider --show-info + perf script -F +pid --input perf.data > perf.firefox + + echo "You probably want to go to https://profiler.firefox.com/" + echo "Either that or run hotspot" +} + +main "${@}"