#measure #per #second #io

speedometer

每秒测量吞吐量

4次发布

使用旧的Rust 2015

0.2.2 2018年4月18日
0.2.1 2018年4月18日
0.2.0 2018年4月18日
0.1.0 2018年4月18日

#292 in 性能分析

每月 36 次下载

MIT/Apache

12KB
76 代码行

speedometer

crates.io version build status downloads docs.rs docs

每秒测量吞吐量。改编自 mafintosh/speedometer

为什么?

在滑动时间范围内计算平均值通常很有用。例如:“在过去5秒内,我们平均接收了多少字节?”或任何类似的事情。此模块允许你在同步代码中这样做。

用法

extern crate speedometer;
use speedometer::Speedometer;
use std::time::Duration;

let window_size = Duration::from_secs(5); // default is 5 second window size
let mut meter = Speedometer::new(window_size);
meter.entry(10);

println!("{:?} bytes/second!", meter.measure().unwrap());

安装

$ cargo add speedometer

许可证

MITApache-2.0

依赖关系

~64KB