Skip to content

Commit

Permalink
tests to a separate mod; benchmarks; rust update
Browse files Browse the repository at this point in the history
  • Loading branch information
akvlad committed Oct 17, 2024
1 parent c713268 commit 8a736eb
Show file tree
Hide file tree
Showing 5 changed files with 1,828 additions and 1,785 deletions.
5 changes: 5 additions & 0 deletions pyroscope/pprof-bin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ memchr = "2.7.4"

[dev-dependencies]
wasm-bindgen-test = "0.3.34"
criterion = { version = "0.5.1", features = ["html_reports"] }

[[bench]]
name = "my_benchmark"
harness = false

[profile.release]
# Tell `rustc` to optimize for small code size.
Expand Down
18 changes: 18 additions & 0 deletions pyroscope/pprof-bin/benches/my_benchmark.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
use pprof_bin::merge_prof;
use pprof_bin::utest::get_test_pprof_data;
use criterion::{black_box, criterion_group, criterion_main, Criterion};

fn merge_bench(pprofs: &Vec<Vec<u8>>) {

for pprof in pprofs {
merge_prof(0, pprof.as_slice(), "process_cpu:samples:count:cpu:nanoseconds".to_string());
}
}

fn criterion_benchmark(c: &mut Criterion) {
let pprofs = get_test_pprof_data();
c.bench_function("merge", |b| b.iter(|| merge_bench(&pprofs)));
}

criterion_group!(benches, criterion_benchmark);
criterion_main!(benches);
Binary file modified pyroscope/pprof-bin/pkg/pprof_bin_bg.wasm
Binary file not shown.
Loading

0 comments on commit 8a736eb

Please sign in to comment.