Macro profiling::scope

source ·
macro_rules! scope {
    ($name:expr) => { ... };
    ($name:expr, $data:expr) => { ... };
}
Expand description

Opens a scope. Two variants:

  • profiling::scope!(name: &str) - Opens a scope with the given name
  • profiling::scope!(name: &str, data: &str) - Opens a scope with the given name and an extra datafield. Details of this depend on the API, but it should be a &str. If the extra data is named, it will be named “tag”. Some APIs support adding more data (for example, optic::tag!)
profiling::scope!("outer");
for _ in 0..10 {
    profiling::scope!("inner", format!("iteration {}").as_str());
}