flamegraph-rs / flamegraph

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

cargo flamegraph should set cargo environment variables #244

Open kuviman opened 1 year ago

kuviman commented 1 year ago

When using cargo run normally, cargo sets environment variables that can be detected from the binary

https://doc.rust-lang.org/cargo/reference/environment-variables.html#environment-variables-cargo-sets-for-crates

Would be nice if running via cargo flamegraph would do same

djc commented 1 year ago

Sure, would you be able to submit a PR?

kuviman commented 1 year ago

I probably would be able, yes

I was wondering though if this is actually wanted. I dont know if people are using those variables from the binary and not during compilation, my use case might be too specific and i can easily work without this

djc commented 1 year ago

Yeah, I do think those variables are mainly intended for compilation time. Since flamegraph doesn't try to compile (it only reuses the Cargo metadata to find compilation targets IIRC), I don't think it would really apply here?