Macro puffin::profile_scope

source ยท
macro_rules! profile_scope {
    ($name:expr) => { ... };
    ($name:expr, $data:expr) => { ... };
}
Expand description

Profile the current scope with the given name (unique in the parent scope).

Names should be descriptive, ASCII and without spaces.

Example: profile_scope!("load_mesh");.

An optional second argument can be a string (e.g. a mesh name) to help diagnose what was slow. Example: profile_scope!("load_mesh", mesh_name);

Overhead: around 54 ns on Macbook Pro with Apple M1 Max.

If the puffin profiler is turned off (crate::are_scopes_on is false), the cost is only checking an AtomicBool, which is less than 1ns.

You can conditionally profile a scope with profile_scope_if.