Skip to content

Measure throughput per second.

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

datrs/speedometer

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

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

Installation

With cargo-edit do:

$ cargo add speedometer

License

MIT OR Apache-2.0

About

Measure throughput per second.

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages