神器 flamer flamer 是这样一个魔法东西,它可以方便地计算出你代码块的耗时。 基本方法,就是在你的代码/函数头和尾(自动)插入计时代码,最后汇总出一个耗时(报告)。用到了
神器 flamer
flamer 是这样一个魔法东西,它可以方便地计算出你代码块的耗时。
基本方法,就是在你的代码/函数头和尾(自动)插入计时代码,最后汇总出一个耗时(报告)。用到了 nightly 的自定义属性,所以暂时只能以 nightly 版运行。看下例子:
extern crate flame;use std::fs::File;
pub fn main() {
// Manual `start` and `end`
flame::start("read file");
let x = read_a_file();
flame::end("read file");
// Time the execution of a closure. (the result of the closure is returned)
let y = flame::span_of("database query", || query_database());
// Time the execution of a block by creating a guard.
let z = {
let _guard = flame::start_guard("cpu-heavy calculation");
cpu_heavy_operations_1();
// Notes can be used to annotate a particular instant in time.
flame::note("something interesting happened", None);
cpu_heavy_operations_2()
};
// Dump the report to disk
flame::dump_html(&mut File::create("flame-graph.html").unwrap()).unwrap();
// Or read and process the data yourself!
let spans = flame::spans();
println!("{} {} {}", x, y, z);
}
------------------------
extern crate flame;
#[macro_use] extern crate flamer;
#[flame]
// The item to apply `flame` to goes here.
Repo
snoopy - 一个可高度配置化的多线程网络包嗅探分析工具
Rust 作这类工具太适合不过了。
➜ sudo snoopy capture run--------------------
Sniffing wlp3s0
--------------------
Source IP | Source Port | Dest IP | Dest Port | Protocol | Length | Timestamp |
------------------------------------------------------------------------------------------------------------------------------------
52.216.185.195 | 443 | 10.20.197.103 | 38522 | Tcp | 10078 | 1562310108.589373
10.20.197.103 | 38522 | 52.216.185.195 | 443 | Tcp | 54 | 1562310108.589468
52.216.185.195 | 443 | 10.20.197.103 | 38522 | Tcp | 10078 | 1562310108.890490
10.20.197.103 | 38522 | 52.216.185.195 | 443 | Tcp | 54 | 1562310108.890547
52.216.185.195 | 443 | 10.20.197.103 | 38522 | Tcp | 1486 | 1562310109.197739
10.20.197.103 | 38522 | 52.216.185.195 | 443 | Tcp | 54 | 1562310109.197795
52.216.185.195 | 443 | 10.20.197.103 | 38522 | Tcp | 1486 | 1562310109.197841
10.20.197.103 | 38522 | 52.216.185.195 | 443 | Tcp | 66 | 1562310109.197865
52.216.185.195 | 443 | 10.20.197.103 | 38522 | Tcp | 2918 | 1562310109.197887
10.20.197.103 | 38522 | 52.216.185.195 | 443 | Tcp | 74 | 1562310109.197906
52.216.185.195 | 443 | 10.20.197.103 | 38522 | Tcp | 1486 | 1562310109.197965
10.20.197.103 | 38522 | 52.216.185.195 | 443 | Tcp | 74 | 1562310109.197984
35.154.102.71 | 443 | 10.20.197.103 | 56572 | Tls | 160 | 1562310109.262324
10.20.197.103 | 56572 | 35.154.102.71 | 443 | Tcp | 66 | 1562310109.262383
Repo
yarte - 号称最快的模板渲染引擎
采用 handlebars 语法。作者说它是 Rust 界最快的模板渲染引擎。
Repo
ferrocarril - 把 Ruby on Rails 嵌入 Rust 服务(容器)中运行的尝试
这个项目很有意思。想法很新颖。
Repo
日报订阅地址:
独立日报订阅地址:
- Telgram Channel
- 阿里云语雀订阅
- Steemit
- GitHub
社区学习交流平台订阅:
- Rust.cc论坛: 支持rss
- Rust Force: 支持rss
- 微信公众号:Rust语言学习交流