Crate timed

Source
Expand description

§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;
}
#[timed(printer = "info!")]
fn add_info(x: i32, y: i32) -> i32 {
    x + y
}
#[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.