flamegraph-rs / flamegraph

Easy flamegraphs for Rust projects and everything else, without Perl or pipes <3
Apache License 2.0
4.61k stars 141 forks source link

Incorrect warning given when running flamegraph for a unit test #311

Open samyak-jain opened 6 months ago

samyak-jain commented 6 months ago

When running the flamegraph command, I get the following warning:

WARNING: profiling without debuginfo. Enable symbol information by adding the following lines to Cargo.toml:

[profile.bench]
debug = true

Or set this environment variable:

CARGO_PROFILE_BENCH_DEBUG=true

However, this is incorrect since to make this warning go away, I need to use profile.release instead. I am using the following command:

cargo flamegraph --unit-test -- example_test

It seems from here: https://github.com/flamegraph-rs/flamegraph/blob/6de8c66f2dda332ba83a74f3393a57dbdaba6ea7/src/bin/cargo-flamegraph.rs#L245 that unit tests should set the profile as release but that doesn't seem to be happening.

djc commented 6 months ago

Thanks for the report. Unfortunately I probably won't be able to address this anytime soon -- however, happy to review a PR if you're able to suggest a fix (or answer questions about doing so).

RRRadicalEdward commented 5 months ago

@samyak-jain how did you manage to get the warning? I'm trying the command and for me it reports:

WARNING: profiling without debuginfo. Enable symbol information by adding the following lines to Cargo.toml:

[profile.release]
debug = true

Or set this environment variable:

CARGO_PROFILE_RELEASE_DEBUG=true