Macro puffin::profile_function
source · 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 54 ns on Macbook Pro with Apple M1 Max.