aboutsummaryrefslogtreecommitdiffstats
path: root/bin/perf
blob: 9a70b08b554dbfb46e6c3c035c75bb75044f9c87 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/sh
set -eux

rm -f target/release/* perf.* || true
if ! grep -q debug Cargo.toml; then
    cat >> Cargo.toml <<EOF

[profile.release]
debug = true
EOF
fi
cargo test --release --no-run
bin=$(find ./target/release -maxdepth 1 -name '*split_escape*' -not -name '*.d')
perf record -F99 --call-graph dwarf,16384 "$bin" --ignored
perf script > perf.script
perl ~/coding/src/FlameGraph/stackcollapse-perf.pl perf.script > perf.collapsed
perl ~/coding/src/FlameGraph/flamegraph.pl perf.collapsed > perf.svg
firefox perf.svg