1
0
Fork 0
mirror of https://github.com/alacritty/alacritty.git synced 2024-11-25 14:05:41 -05:00
alacritty/scripts/create-flamegraph.sh
Nathan Lilienthal f32facfbfd Refactor Alacritty scripts
This includes some changes to the scripts `README.md` to provide
some more information on the different Alacritty scripts.

A new script for testing the 24 bit support of Alacritty has been
added with the `24-bit-color.sh` name. This should help with
troubleshooting truecolor support issues.

Since `perf` is a standard tool which is available in the official
repositories for most distributions, it doesn't make much sense to
provide an installation script specifically for Ubuntu. As a result of
this, the script has been removed.
2018-12-08 20:28:57 +00:00

38 lines
1 KiB
Bash
Executable file

#!/usr/bin/env bash
# The full path to the script directory, regardless of pwd.
DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# Current UNIX time.
TIME=$(date +%s)
# Make sure FlameGraph scripts are available.
if [ ! -e $DIR/FlameGraph ]
then
git clone https://github.com/BrendanGregg/FlameGraph \
$DIR/create-flamegraph/FlameGraph
fi
# Make sure a release build of Alacritty is available.
if [ ! -e $DIR/../target/release/alacritty ]
then
echo "Must build alacritty first: cargo build --release"
exit 1
fi
# Make sure perf is available.
if [ ! -x "$(command -v perf)" ]
then
echo "Cannot find perf, please make sure it's installed"
exit 1
fi
# Run perf, this will block while alacritty runs.
perf record -g -F 99 $DIR/../target/release/alacritty
perf script \
| $DIR/create-flamegraph/FlameGraph/stackcollapse-perf.pl \
| $DIR/create-flamegraph/FlameGraph/flamegraph.pl --width 1920 \
> flame-$TIME.svg
# Tell users where the file is.
echo "Flame graph created at: file://$(pwd)/flame-$TIME.svg"