Crates.io | elapsed-time |
lib.rs | elapsed-time |
version | 0.1.1 |
source | src |
created_at | 2022-02-01 15:58:25.661982 |
updated_at | 2023-11-21 13:35:01.762758 |
description | This crate help you to measure time taken by a function or a block of code for print debugging purpose. It output in stdout (using println) the elapsed time. |
homepage | |
repository | https://github.com/nmeylan/elapsed-time |
max_upload_size | |
id | 525239 |
size | 5,068 |
This crate help you to measure time taken by a function or a block of code for "print" debugging purpose. It output in stdout (using println
) the elapsed time.
elapsed-time = "0.1"
#[macro_use]
extern crate elapsed_time;
fn main() {
// measure time taken by a block
#[elapsed_time::elapsed_block(block_name_1)]
{
// some piece of code in a block
}
my_func();
}
// measure time taken by a function
#[elapsed_time::elapsed]
fn my_func() -> String { }
Produce following logs:
block_name_1 tooks 793.515574ms
my_func tooks 28.855µs