flamegraph
flamegraph copied to clipboard
Flamegraph of non "default-member" binary in a Workspace project
I have a workspace project with this Cargo.toml
:
[workspace]
members = ["flowc", "flowr", "flowrstructs", "provider", "flow_impl", "flow_impl_derive", "flowstdlib", "samples"]
default-members = ["flowc"]
So that cargo run
runs flowc
by default.
To run other binaries I use the -p
(package) flag of cargo, thus:
cargo run -p flowr -- -n samples/fibonacci
I can't figure out how to generate a flamegraph for flowr
using cargo. Here are the options I have tried:
cargo flamegraph --dev -p flowr -- -n samples/fibonacci
Finished dev [unoptimized + debuginfo] target(s) in 0.28s
several possible targets found: ["flowc", "flowc-loader_tests", "flowc-compiler_tests", "flowc-execution_tests", "helper", "flowc-sample_loading_tests", "flowr", "flowr-loader_tests", "flowstdlib", "build-script-build", "flowsamples", "build-script-build"], please pass `--bin <binary>` or `--example <example>` to cargo flamegraph to choose one of them
or
cargo flamegraph --dev --bin flowr -- -n samples/fibonacci
error: no bin target named `flowr`
Did you mean `flowc`?
cargo build failed: None
or following flamegraph
readme that shows --bin=<binary>
cargo flamegraph --dev --bin=flowr -- -n samples/fibonacci
error: no bin target named `flowr`
Did you mean `flowc`?
cargo build failed: None
I'll try by using flamegraph
directly (without cargo) and the path to the binary, but would appreciate being able to use cargo
. Thanks.
Are you using version 0.4 already?
Yes, just build from source using cargo install
Can you try running with -v
/--verbose
? This should give you more info about what path it is searching for.
You could also just review the source code to see what might need changing:
https://github.com/flamegraph-rs/flamegraph/blob/master/src/bin/cargo-flamegraph.rs#L254