Crates.io | funtime |
lib.rs | funtime |
version | 0.3.1 |
source | src |
created_at | 2019-11-19 20:13:04.252649 |
updated_at | 2019-11-21 15:07:11.483308 |
description | A proc-macro helper to time Rust functions |
homepage | |
repository | |
max_upload_size | |
id | 182526 |
size | 8,035 |
A small proc-macro helper to time every statement in a given function (or item method).
#[funtime::timed]
fn foo(y: i32) -> i32 {
let mut x = 1;
let d = 1_000;
x += d;
x += y;
x
}
#[funtime::timed]
fn main() {
foo(23);
}
Prints:
funtime start: `foo`
took 1µs: `let mut x = 1 ;`
took 5µs: `let d = 1_000 ;`
took 2µs: `x += d ;`
took 2µs: `x += y ;`
took 3µs: `x`
funtime end: `foo` took 12µs
funtime start: `main`
took 49µs: `foo (23) ;`
funtime end: `main` took 56µs
Current version: 0.3.0
.
Supports rustc 1.31
and up.