#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

#606 in Graphics APIs

Download history 30/week @ 2024-07-21 47/week @ 2024-07-28 32/week @ 2024-08-04 28/week @ 2024-08-11 38/week @ 2024-08-18 52/week @ 2024-08-25 24/week @ 2024-09-01 36/week @ 2024-09-08 27/week @ 2024-09-15 42/week @ 2024-09-22 23/week @ 2024-09-29 59/week @ 2024-10-06 91/week @ 2024-10-13 19/week @ 2024-10-20 46/week @ 2024-10-27 26/week @ 2024-11-03

195 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