#frame-rate #creative #sketch #graphics #audio

fps_ticker

A simple crate for measuring the average, minimum and maximum frame rate over a window of time

1 stable release

1.0.0 May 10, 2020

#592 in Graphics APIs

Download history 9/week @ 2024-01-01 45/week @ 2024-01-08 40/week @ 2024-01-15 16/week @ 2024-01-22 25/week @ 2024-01-29 37/week @ 2024-02-05 37/week @ 2024-02-12 59/week @ 2024-02-19 53/week @ 2024-02-26 65/week @ 2024-03-04 48/week @ 2024-03-11 36/week @ 2024-03-18 45/week @ 2024-03-25 103/week @ 2024-04-01 33/week @ 2024-04-08 39/week @ 2024-04-15

225 downloads per month

MIT/Apache

7KB
81 lines

fps_ticker Crates.io docs.rs

A simple crate for measuring the average, minimum and maximum frame rate over a window of time.

Usage

Specify a window length over which the average, minimum and maximum values will be measured.

use fps_ticker::Fps;

fn main() {
    let fps = Fps::with_window_len(100);
}

Or create an instance with the default window length of 60.

let fps = Fps::default();

Call tick once per frame at the point at which you wish to measure the rate. This samples the duration since the last tick, adds it to the window, removes the oldest duration from the window if necessary and re-calculates the average, minimum and maximum rate over the resulting window.

fps.tick();

Now we can retrieve the average, minimum and maximum rate over the window of time.

fps.avg();
fps.min();
fps.max();

No runtime deps