For function calls
https://github.com/flamegraph-rs/flamegraph
cargo install flamegraph
CARGO_PROFILE_BENCH_DEBUG=true sudo cargo flamegraph --bench full_solvency_flow -- --bench
open flamegraph.svg
For heap allocation
cargo.toml
[features]
dev-graph = ["halo2_proofs/dev-graph", "plotters"]
dhat-heap = []
[dependencies]
dhat = "0.3.2"
[profile.release]
debug = 1
tests.rs
#[cfg(feature = "dhat-heap")]
#[global_allocator]
static ALLOC: dhat::Alloc = dhat::Alloc;
#[test]
fn test_mst() {
#[cfg(feature = "dhat-heap")]
let _profiler = dhat::Profiler::new_heap();
// create new merkle tree
let merkle_tree =
MerkleSumTree::<N_ASSETS, N_BYTES>::new("src/merkle_sum_tree/csv/entry_16.csv")
.unwrap();
}
cargo test test_mst --features dhat-heap
For visualization => https://nnethercote.github.io/dh_view/dh_view.html