#profiling #execution #execution-time #line #prints #super #profiler

print_each_line

它在执行过程中打印每一行和执行时间。您可以用它作为一个非常简单的性能分析器。

1个不稳定版本

0.1.0 2022年5月12日

#1109过程宏

MIT 许可证

75KB
125

print_each_line

它在执行过程中打印每一行和执行时间。它可以作为一个非常简单的性能分析器。

示例

use print_each_line::printline;
use dpss::dp;
use std::thread::sleep;
use std::time::{Duration};

#[printline]
fn main() {
    
    let arr = vec![-2445617,1415464,-1234475,-8719641,4811893];
    let result = dp::find_subset(arr, -3907748, 100);
    sleep(Duration::from_millis(1234));
    let route1: Vec<i32> = vec![-8719641, 4811893];
    let answer: Vec<Vec<i32>> = vec![route1];
    assert_eq!(result, answer);

}

输出

Ran ... 📄 let arr = vec ! [- 2445617, 1415464, - 1234475, - 8719641, 4811893]  📄 ...(Elapsed 0 milliseconds) ⌛
Ran ... 📄 let result = dp :: find_subset (arr, - 3907748, 100)  📄 ...(Elapsed 325 milliseconds) ⌛
Ran ... 📄 sleep (Duration :: from_millis(1234))  📄 ...(Elapsed 1236 milliseconds) ⌛
Ran ... 📄 let route1 : Vec < i32 > = vec ! [- 8719641, 4811893]  📄 ...(Elapsed 0 milliseconds) ⌛
Ran ... 📄 let answer : Vec < Vec < i32 >> = vec ! [route1]  📄 ...(Elapsed 0 milliseconds) ⌛
Ran ... 📄 assert_eq ! (result, answer)  📄 ...(Elapsed 0 milliseconds)

example

依赖项

~1.5MB
~35K SLoC