2个版本
0.1.1 | 2021年12月9日 |
---|---|
0.1.0 | 2021年12月9日 |
#390 in 性能分析
11KB
189 行
profl
简单的计时分析器
示例
fn main() -> std::io::Result<()> {
profl::init("timings.data");
let mut total = 0;
for i in 0..1000 {
total += profl::span!("some_ctx", {
// long operation
std::thread::sleep(std::time::Duration::from_millis(i % 40));
i
});
}
Ok(())
}
处理结果
profl --path timings.data
渲染的指标(plot.svg
)
输出
All ids:
some_ctx: 684
Histogram for some_ctx
Distribution
0µs | * | 0.1th %-ile
1114µs | ** | 5.1th %-ile
3145µs | *** | 10.5th %-ile
5242µs | ** | 15.4th %-ile
7340µs | *** | 20.5th %-ile
9437µs | ** | 25.4th %-ile
11534µs | ** | 30.4th %-ile
13631µs | ** | 35.2th %-ile
15728µs | *** | 40.4th %-ile
17825µs | ** | 45.3th %-ile
19922µs | ** | 50.1th %-ile
20971µs | ** | 52.8th %-ile
22020µs | * | 55.3th %-ile
23068µs | ** | 58.3th %-ile
24117µs | ** | 62.1th %-ile
25165µs | ** | 64.9th %-ile
26214µs | * | 67.1th %-ile
27262µs | ** | 69.7th %-ile
28311µs | ** | 72.7th %-ile
28311µs | | 72.7th %-ile
29360µs | * | 75.1th %-ile
30408µs | * | 77.6th %-ile
30408µs | | 77.6th %-ile
31457µs | * | 80.0th %-ile
32505µs | ** | 82.6th %-ile
32505µs | | 82.6th %-ile
32505µs | | 82.6th %-ile
33554µs | * | 85.1th %-ile
33554µs | | 85.1th %-ile
35651µs | ** | 90.1th %-ile
35651µs | | 90.1th %-ile
35651µs | | 90.1th %-ile
35651µs | | 90.1th %-ile
35651µs | | 90.1th %-ile
依赖项
~16MB
~148K SLoC