Skip to content

Instantly share code, notes, and snippets.

@azriel91
Created June 2, 2020 21:36
Show Gist options
  • Select an option

  • Save azriel91/de753703aed3b4307a8eb3494f38497c to your computer and use it in GitHub Desktop.

Select an option

Save azriel91/de753703aed3b4307a8eb3494f38497c to your computer and use it in GitHub Desktop.

Using Thread Profiler

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 profiler

when you close the application, you can open profile.json with chrome at chrome://tracing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment