2023-08-21 05:26:52 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
#
|
|
|
|
set -euo pipefail
|
|
|
|
IFS=$'\n\t'
|
|
|
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
|
|
|
|
|
|
: ${PROFILE:="perf"}
|
|
|
|
|
2023-08-27 21:02:12 +00:00
|
|
|
function main {
|
|
|
|
local additional_flags=()
|
|
|
|
if [ "$PROFILE" = "dev" ] || [ "$PROFILE" = "debug" ]; then
|
|
|
|
PROFILE="debug"
|
|
|
|
else
|
|
|
|
additional_flags+=(--profile "$PROFILE")
|
|
|
|
fi
|
2023-09-09 01:50:32 +00:00
|
|
|
(cd "$DIR/../" && cargo build --no-default-features "${additional_flags[@]}")
|
2023-10-17 14:57:04 +00:00
|
|
|
perf record --freq=70000 --call-graph dwarf --output="$DIR/../perf.data" "$DIR/../target/${PROFILE}/parse" "${@}"
|
2023-08-21 05:26:52 +00:00
|
|
|
|
2023-08-27 21:02:12 +00:00
|
|
|
# Convert to a format firefox will read
|
|
|
|
# flags to consider --show-info
|
2023-09-09 01:50:32 +00:00
|
|
|
perf script -F +pid --input "$DIR/../perf.data" > "$DIR/../perf.firefox"
|
2023-08-27 21:02:12 +00:00
|
|
|
|
|
|
|
echo "You probably want to go to https://profiler.firefox.com/"
|
|
|
|
echo "Either that or run hotspot"
|
|
|
|
}
|
|
|
|
|
|
|
|
main "${@}"
|