tikv / pprof-rs

A Rust CPU profiler implemented with the help of backtrace-rs
Apache License 2.0
1.29k stars 99 forks source link

support for criterion 0.4 #164

Closed PSeitz closed 1 year ago

PSeitz commented 1 year ago

criterion 0.4 has recently been released. The Profiler trait changed and is not compatible currently with pprof.

error[E0277]: the trait bound `PProfProfiler<'_, '_>: Profiler` is not satisfied
   --> benches/index-bench.rs:118:49
    |
118 |     config = Criterion::default().with_profiler(PProfProfiler::new(100, Output::Flamegraph(None)));
    |                                   ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Profiler` is not implemented for `PProfProfiler<'_, '_>`
    |                                   |
    |                                   required by a bound introduced by this call
    |
    = help: the trait `Profiler` is implemented for `ExternalProfiler`
note: required by a bound in `Criterion::<M>::with_profiler`
   --> /home/pascal/.cargo/registry/src/github.com-1ecc6299db9ec823/criterion-0.4.0/src/lib.rs:462:29
    |
462 |     pub fn with_profiler<P: Profiler + 'static>(self, p: P) -> Criterion<M> {
    |                             ^^^^^^^^ required by this bound in `Criterion::<M>::with_profiler`
tversteeg commented 1 year ago

There's #163 for this.

PSeitz commented 1 year ago

Cool, it's been merged. @YangKeao Can you release a new version?

TheLostLambda commented 1 year ago

Seconding this! Would be nice to have a version released with this PR integrated!

Fomalhauthmj commented 1 year ago

Before the newer release,we can use pprof = { git = "https://github.com/tikv/pprof-rs", features = [ "flamegraph", "criterion", ] } in Cargo.toml temporarily.

aminya commented 1 year ago

Before the newer release,we can use pprof = { git = "https://github.com/tikv/pprof-rs", features = [ "flamegraph", "criterion", ] } in Cargo.toml temporarily.

Thanks. Yeah, the master branch works with Criterion 0.4. I would recommend a locked rev just for reproducibility:

[target.'cfg(unix)'.dev-dependencies]
# pprof = "0.10.1"
pprof = { git = "https://github.com/tikv/pprof-rs", rev="a280c9e71f", features = ["flamegraph", "criterion"] }
breezewish commented 1 year ago

0.11.0 is released, which contains the change 🎉