#measure #per #second #io

speedometer

Measure throughput per second

4 releases

Uses old Rust 2015

0.2.2 Apr 18, 2018
0.2.1 Apr 18, 2018
0.2.0 Apr 18, 2018
0.1.0 Apr 18, 2018

#400 in Profiling

MIT/Apache

12KB
76 lines

speedometer

crates.io version build status downloads docs.rs docs

Measure throughput per second. Adapted from mafintosh/speedometer.

Why?

It's often useful to figure out the average over a sliding timeframe. For example: "how many bytes did we receive on average over the last 5 seconds?". Or anything similar. This module allows you to do so in synchronous code.

Usage

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());

Installation

$ cargo add speedometer

License

MIT OR Apache-2.0

Dependencies

~65KB