Skip to main content

profile_current_function

Macro profile_current_function 

Source
macro_rules! profile_current_function {
    () => { ... };
    ($category:expr) => { ... };
}
Expand description

Profile the current function automatically

ยงExamples

use torsh_profiler::profile_current_function;

fn my_expensive_function(x: i32) -> i32 {
    profile_current_function!();
    // This function will be automatically profiled
    x * x
}

fn my_computation(data: &[f32]) -> f32 {
    profile_current_function!("computation");
    // This function will be profiled under "computation" category
    data.iter().sum()
}