Expand description
The frame_counter library provides a very simple to use framerate counter based around the rust time module.
Additionally the FrameCounter
can also be used to cap the framerate at a certain value either in a hot or cold loop.
§Examples:
Counting the framerate:
use frame_counter::FrameCounter;
pub fn dummy_workload() {
std::thread::sleep(std::time::Duration::from_millis(10));
}
pub fn main() {
let mut frame_counter = FrameCounter::default();
loop {
frame_counter.tick();
dummy_workload();
println!("fps stats - {}", frame_counter);
}
}