5 unstable releases

0.3.1 Nov 21, 2019
0.3.0 Nov 21, 2019
0.2.1 Nov 20, 2019
0.2.0 Nov 20, 2019
0.1.0 Nov 19, 2019

#1866 in Procedural macros

MIT/Apache

6KB
98 lines

funtime

Docs Crates.io

A small proc-macro helper to time every statement in a given function (or item method).

Usage

#[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.

Dependencies

~1.5MB
~34K SLoC