#metrics #performance #real-time #statistics

running-average

Calculate running average with specified time window width using constant memory

1 unstable release

Uses old Rust 2015

0.1.0 Oct 15, 2018

#902 in Machine learning

Download history 83/week @ 2024-07-25 172/week @ 2024-08-01 212/week @ 2024-08-08 383/week @ 2024-08-15 130/week @ 2024-08-22 282/week @ 2024-08-29 317/week @ 2024-09-05 86/week @ 2024-09-12 82/week @ 2024-09-19 127/week @ 2024-09-26 137/week @ 2024-10-03 256/week @ 2024-10-10 250/week @ 2024-10-17 236/week @ 2024-10-24 235/week @ 2024-10-31 297/week @ 2024-11-07

1,108 downloads per month
Used in 2 crates

MIT license

16KB
264 lines

Rust crate that provides RunningAverage and RealTimeRunningAverage types that allow to calculate running average with specified time window width using constant memory.

The RunningAverage type can be used when processing streams of temporal data while RealTimeRunningAverage can be used when measured events are happening in real time.

For example RealTimeRunningAverage can be used to measure download throughput by inserting how many bytes were transferred.

use running_average::RealTimeRunningAverage;

// By default use 8 second window with 16 accumulators
let mut tw = RealTimeRunningAverage::default();

// Connect and start downloading
// Got 2KB of data
tw.insert(2000);

// Waiting for more data
// Got 1KB of data
tw.insert(1000);

// Print average transfer for last 8 seconds
println!("{}", tw.measurement());

lib.rs:

RunningAverage and RealTimeRunningAverage types allow to calculate running average with specified time window width using constant memory.

The RunningAverage type can be used when processing streams of temporal data while RealTimeRunningAverage can be used when measured events are happening in real time.

For example RealTimeRunningAverage can be used to measure download throughput by inserting how many bytes were transferred.

use running_average::RealTimeRunningAverage;

// By default use 8 second window with 16 accumulators
let mut tw = RealTimeRunningAverage::default();

// Connect and start downloading
// Got 2KB of data
tw.insert(2000);

// Waiting for more data
// Got 1KB of data
tw.insert(1000);

// Print average transfer for last 8 seconds
println!("{}", tw.measurement());

No runtime deps