I have a library crate which I want to profile using cargo flamegraph. But however I try to run cargo flamegraph, I get error messages. The library has the following structure:
utilrs
├── Cargo.lock
├── Cargo.toml
└── src
├── fileprocessor.rs
├── filesplit.rs
├── forwardstar.rs
├── lib.rs
├── persistence.rs
└── xmlparser.rs
What I am looking for is to exectue a test called split_and_process_file
within a tests
module within the fileprocessor.rs
file.
I tried different command line combinations, but they all resulted in errors. Some of the things I tried are:
cargo flamegraph --unit-test -- fileprocessor::tests::split_and_process_file
resulting in :Error: crate has no automatically selectable target
and
cargo flamegraph --unit-test utilrs -- fileprocessor::tests::split_and_process_file
resulting in error: no bin target named `utilrs`.
System Information: |Component | Version| |----------|--------| |Operating System|Windows 10, 64-bit| |cargo |cargo 1.65.0-nightly (4ed54cecc 2022-08-27)| |rustc|rustc 1.65.0-nightly (84f0c3f79 2022-09-03)|
cargo flamegraph --unit-test split_and_process_file
? – Dumyatcargo flamegraph --unit-test split_and_process_file
that results in the following error:error: no bin target named 'split_and_process_file'
– Kaiserslautern