Skip to content

Commit

Permalink
Scripts for performance profiling and statistics
Browse files Browse the repository at this point in the history
  • Loading branch information
sunjay committed Oct 27, 2017
1 parent 6b1eb9f commit a9e0722
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
@@ -1,3 +1,6 @@
perf.data*
flame.svg

# Created by https://www.gitignore.io/api/rust

### Rust ###
Expand Down
14 changes: 14 additions & 0 deletions perf-flame
@@ -0,0 +1,14 @@
#!/usr/bin/env bash

set -e

if [ $# -eq 0 ]; then
echo "Please provide the name of an example to profile"
exit 1
fi

RUSTFLAGS='-C debuginfo=2' cargo build --release --example "$1"
perf record -g "target/release/examples/$1" --bench "$1"
perf script | stackcollapse-perf | flamegraph > flame.svg

echo "Flamegraph written to 'flame.svg'"
11 changes: 11 additions & 0 deletions perf-stat
@@ -0,0 +1,11 @@
#!/usr/bin/env bash

set -e

if [ $# -eq 0 ]; then
echo "Please provide the name of an example to profile"
exit 1
fi

RUSTFLAGS='-C debuginfo=2' cargo build --release --example "$1"
perf stat -e cycles,L1-dcache-load-misses,instructions,cache-misses,context-switches "./target/release/examples/$1"

0 comments on commit a9e0722

Please sign in to comment.