Commit b80abe9a authored by Joe Wilm's avatar Joe Wilm

Add script for creating flamegraph with perf

Resolves #8
parent b91c90dc
scripts
=======
There are two scripts included at the time this README was written, and they
both support flamegraph generation on Ubuntu. The first script installs the
required dependencies:
```sh
scripts/ubuntu-install-perf.sh
```
The second script will run Alacritty while recording call stacks. After the
Alacritty process exits, a flamegraph will be generated and its URI printed.
```sh
scripts/create-flamegraph.sh
```
**NOTE**: The _create-flamegraph.sh_ script is intended to be run from the
alacritty project root.
#!/usr/bin/env bash
# Make sure FlameGraph scripts are available
if [ ! -e ./FlameGraph ]
then
git clone https://github.com/BrendanGregg/FlameGraph
fi
if [ ! -e target/release/alacritty ]
then
echo "Must build alacritty first: cargo build --release"
exit 1
fi
# This will block while alacritty runs
perf record -g -F 99 target/release/alacritty
perf script | ./FlameGraph/stackcollapse-perf.pl | ./FlameGraph/flamegraph.pl --width 1920 > alacritty.svg
echo "Flame graph created at file://$(pwd)/alacritty.svg"
#!/usr/bin/env bash
set -v
# Get kernel info
UNAME=$(uname -r)
# Install linux tools for the perf binary
sudo apt-get install -y \
linux-tools-common \
linux-tools-generic \
linux-tools-$UNAME
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment