flamegraph icon indicating copy to clipboard operation
flamegraph copied to clipboard

Cannot run benchmarks for library crate

Open m-schubert opened this issue 5 years ago • 5 comments

Some strange oddities. I'm currently developing a quick Python module in Rust to do curve simplification, and I'm trying to use flamegraph to help me profile the code.

Running a specific benchmark works fine:

[shoobs@fabiana curved]$ cargo bench --bench rdp
   Compiling curved v0.1.0 (/home/shoobs/Code/curved)
    Finished bench [optimized + debuginfo] target(s) in 3.30s
     Running target/release/deps/rdp-6098376c514929c6

running 1 test
test large_2d ... bench:  75,888,252 ns/iter (+/- 10,891,873)

test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured; 0 filtered out

Trying to run flamegraph for the same benchmark:

[shoobs@fabiana curved]$ cargo flamegraph --bench rdp
   Compiling pyo3 v0.9.0
   Compiling numpy v0.8.0
   Compiling curved v0.1.0 (/home/shoobs/Code/curved)
    Finished release [optimized] target(s) in 9.50s
could not find desired target rdp in the bench targets for this crate

It's also odd that running flamegraph forces a recompile of a few libraries even after running the benchmark immediately before.

m-schubert avatar Mar 25 '20 11:03 m-schubert

Same problem here.

nanne007 avatar Jul 09 '20 12:07 nanne007

I had the same issue and created #102 which fixes this for me.

arnej avatar Oct 05 '20 14:10 arnej

I was just looking into this and seeing if I could fix it. this does indeed fix it! thanks I hope that gets merged

JAicewizard avatar Oct 12 '20 18:10 JAicewizard

I'm using flamegraph-rs on nixos and I don't have a great way of overriding to arnej's repo for the time being... would love to see #102 merged so it can find it's way downstream :)

EDIT: just looked at the PR, I think it's possible this is occurring for me with a test rather than a benchmark, but I'm not totally sure.

sloane-shark avatar Nov 05 '20 01:11 sloane-shark

I created a new tool, which fixes this issue and supports arguments on mac properly

See: https://github.com/kdy1/cargo-profile

kdy1 avatar Nov 28 '20 12:11 kdy1