Crates.io | frame_counter |
lib.rs | frame_counter |
version | 0.1.2 |
source | src |
created_at | 2021-04-02 19:36:14.277999 |
updated_at | 2021-04-02 19:57:40.592606 |
description | simple frame counter and limiter |
homepage | |
repository | https://github.com/ko1N/frame_counter |
max_upload_size | |
id | 377855 |
size | 10,051 |
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.
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);
}
}