alacritty/scripts/create-flamegraph.sh
Christian Duerr 0f15dc05d9 Switch to flamegraph-rs script
This cleans up the Alacritty scripts a bit by removing some of them
which are not recommended to be used anymore and switching from the
official FlameGraph tool to the more specialized Rust FlameGraph
implementation.
2020-01-27 02:30:23 +03:00

32 lines
836 B
Bash
Executable file

#!/usr/bin/env bash
# The full path to the script directory, regardless of pwd.
DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# Make sure perf is available.
if [ ! -x "$(command -v perf)" ]
then
echo "Cannot find perf, please make sure it's installed."
exit 1
fi
# Install cargo-flamegraph
installed_flamegraph=0
if [ ! -x "$(command -v cargo-flamegraph)" ]; then
echo "cargo-flamegraph not installed; installing ..."
cargo install flamegraph
installed_flamegraph=1
fi
# Create flamegraph
cargo flamegraph --bin=alacritty -- $@
# Unintall cargo-flamegraph if it has been installed with this script
if [ $installed_flamegraph == 1 ]; then
read -p "Would you like to uninstall cargo-flamegraph? [Y/n] " -n 1 -r
echo
if [[ "$REPLY" =~ ^[^Nn]*$ ]]; then
cargo uninstall flamegraph
fi
fi