macro_rules! profile_function {
    () => { ... };
    ($data:expr) => { ... };
}
Expand description

Automatically name the profiling scope based on function name.

Names should be descriptive, ASCII and without spaces.

Example:

fn load_image(path: &str) -> Image {
    puffin::profile_function!();
    /* … */
    image
}

An optional argument can be a string describing e.g. an argument, to help diagnose what was slow.

fn load_image(path: &str) -> Image {
    puffin::profile_function!(path);
    /* … */
    image
}

Overhead: around 210 ns on 2020 Intel MacBook Pro.