Function ra_ap_profile::span[][src]

pub fn span(label: &'static str) -> ProfileSpan
Expand description

This function starts a profiling scope in the current execution stack with a given description. It returns a Profile struct that measures elapsed time between this method invocation and Profile struct drop. It supports nested profiling scopes in case when this function is invoked multiple times at the execution stack. In this case the profiling information will be nested at the output. Profiling information is being printed in the stderr.

Example

profile::init_from("profile1|profile2@2");
profiling_function1();

fn profiling_function1() {
    let _p = profile::span("profile1");
    profiling_function2();
}

fn profiling_function2() {
    let _p = profile::span("profile2");
}

This will print in the stderr the following:

 0ms - profile
     0ms - profile2