[][src]Crate timed

Timed

Macros for measuring function execution.

#[timed::timed]
fn add(x: i32, y: i32) -> i32 {
    x + y
}

It will output:

// function=add duration=112ns

Times the execution of the function

Examples

use timed::timed;

#[timed]
fn add(x: i32, y: i32) -> i32 {
    x + y
}

#[timed(duration(printer = "println!"))]
async fn google()  {
    // reqwest::get("https://google.com").await;
}
This example is not tested
#[timed(printer = "info!")]
fn add_info(x: i32, y: i32) -> i32 {
    x + y
}
This example is not tested
#[tokio::main]
#[timed]
async fn main() {
    reqwest::get("https://google.com").await;
}

Structs

Hop
Trace

Enums

Phase

Attribute Macros

timed

Macro that times your function execution.