Add script for creating flamegraph with perf

Resolves #8
This commit is contained in:
Joe Wilm committed 2016-10-08 21:30:21 -07:00
1 parent b91c90dc34
commit b80abe9a54
4 files changed
+51

No files matched your search

+1
View File
@@ -1 +1,2 @@
target
FlameGraph
+20
View File
@@ -0,0 +1,20 @@
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.
+19
View File
@@ -0,0 +1,19 @@
#!/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"
+11
View File
@@ -0,0 +1,11 @@
#!/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