In Cargo.toml, include the following:
[dependencies]
thread_profiler = { version = "0.3", optional = true } # the optional is important
[features]
profiler = ["thread_profiler", "thread_profiler/thread_profiler"]then at the beginning of each system add something like this:
#[cfg(feature = "profiler")]
profile_scope!("my_loading_system");then run
cargo run --features profilerwhen you close the application, you can open profile.json with chrome at chrome://tracing