flamegraph icon indicating copy to clipboard operation
flamegraph copied to clipboard

Incorrect warning given when running flamegraph for a unit test

Open samyak-jain opened this issue 11 months ago • 2 comments

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.

samyak-jain avatar Mar 09 '24 00:03 samyak-jain

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).

djc avatar Mar 11 '24 13:03 djc

@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

RRRadicalEdward avatar Apr 13 '24 14:04 RRRadicalEdward