Skip to content

Commit

Permalink
bench: support profiling (#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
byte-sourcerer authored Sep 20, 2024
1 parent 6c018b4 commit 35686fd
Show file tree
Hide file tree
Showing 3 changed files with 184 additions and 3 deletions.
173 changes: 173 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ atomic_enum = "0.3.0"
tempfile = "3"
ycsb = { git = "https://github.com/cjwcommuny/ycsb-rs.git", rev = "b82522d" }
criterion = { version = "0.5.1", features = ["async_tokio"] }
pprof = { version = "0.13", features = ["flamegraph", "criterion"] }
maplit = "1.0.2"

[lints.rust]
Expand Down
13 changes: 10 additions & 3 deletions benches/benches_against_rocksdb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use better_mini_lsm::test_utils::integration::mydb::{build_sst_options, MyDbWith
use better_mini_lsm::test_utils::integration::pair::DbPair;
use better_mini_lsm::test_utils::integration::rocksdb::{build_rocks_db, build_rocks_options};
use criterion::{criterion_group, criterion_main, Criterion};
use pprof::criterion::{Output, PProfProfiler};
use std::sync::Arc;
use tempfile::TempDir;

Expand Down Expand Up @@ -256,10 +257,16 @@ fn pair_test(c: &mut Criterion) {
})
}

fn build_criterion_config() -> Criterion {
Criterion::default()
.sample_size(SAMPLE_SIZE)
.with_profiler(PProfProfiler::new(10, Output::Flamegraph(None)))
}

criterion_group! {
name = bench_against_rocks;
config = Criterion::default().sample_size(SAMPLE_SIZE);
targets = bench_rocks, bench_mydb
name = bench_against_rocks;
config = build_criterion_config();
targets = bench_rocks, bench_mydb
}

criterion_main!(bench_against_rocks);

0 comments on commit 35686fd

Please sign in to comment.