bheisler / iai

Experimental one-shot benchmarking/profiling harness for Rust
Apache License 2.0
578 stars 23 forks source link

Do not work with valgrind 3.21 #36

Open Fi3 opened 1 year ago

Fi3 commented 1 year ago

I'm using fedora 38 and when I install valgrind i get the 3.21 version. Iai seem to not work with it, if I run the example in the README I get:

thread 'main' panicked at 'no entry found for key', /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/iai-0.1.1/src/lib.rs:163:40

If I print events at line 160 of lib.rs I get: Events: {"Ir": 442824}

Downgrading to valgrind 3.18 solve the issue

Oppen commented 1 month ago

I made a quick fork for those who can't migrate to iai-callgrind which is more actively maintained. You can override the dep to point to the fixed version:

[patch.crates-io]
iai = { git = "https://github.com/lambdaclass/iai", branch = "fix/valgrind-forward-compatibility" }

What the fix does is add explicitly the --cache-sim=yes argument for cachegrind, since from version 3.21 and later it defaults to --cache-sim=no, so the expected events are not emitted.