5个不稳定版本
0.3.1 | 2019年11月21日 |
---|---|
0.3.0 | 2019年11月21日 |
0.2.1 | 2019年11月20日 |
0.2.0 | 2019年11月20日 |
0.1.0 | 2019年11月19日 |
#2022 in 过程宏
6KB
98 代码行
fun_time
一个用于计时给定函数(或项方法)中每个语句的小型过程宏辅助工具。
用法
#[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);
}
输出
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
当前版本: 0.3.0
。
支持 rustc 1.31
及以上版本。
依赖
~1.5MB
~35K SLoC