Skip to content

Instantly share code, notes, and snippets.

@protolambda
Created August 7, 2019 01:27
Show Gist options
  • Save protolambda/90ef8423b22338674f8fd22a40b1b9d2 to your computer and use it in GitHub Desktop.
Save protolambda/90ef8423b22338674f8fd22a40b1b9d2 to your computer and use it in GitHub Desktop.
# Pre-req:
# perf, rust, perl
# Enable debug in cargo
#
# [profile.release]
# debug = true
# create benchmark binary with callgraph information
RUSTFLAGS="-g" cargo bench --features="bench" --no-run
# Record the benchmark with perf, pass arguments to Criterion (benchmark bloat). Try --help for (limited) options.
perf record -g target/release/bls381_benches-9a3877c5bcf3fbe7 verify_aggregate_128_same_msg
# this outputs a "perf.data" file
# Perl scripts for flamegraph creation from perf data can be downloaded with:
# git clone https://github.com/brendangregg/FlameGraph
# Convert the "perf.data" into an interactive flamegraph SVG
perf script | perl ../FlameGraph/stackcollapse-perf.pl | perl ../FlameGraph/flamegraph.pl > flame.svg
# Or read data in a tree-form in CLI
perf report
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment