2 #include "fps_counter.h"
4 void fps_start(fps_counter *fpsc, unsigned long time, unsigned long sample_interval) {
5 fpsc->sample_interval = sample_interval;
6 fpsc->sample_start_time = time;
11 int fps_frame_proc(fps_counter *fpsc, unsigned long time) {
12 if(time - fpsc->sample_start_time < fpsc->sample_interval) {
16 fpsc->fps = (float)fpsc->frame_count / ((float)fpsc->sample_interval / 1000.0f);
18 fpsc->sample_start_time = time;
19 fpsc->frame_count = 0;
24 /* changed it to a macro, see header */
26 float fps_get_frame_rate(fps_counter *fpsc) {
31 const char *fps_get_frame_rate_str(fps_counter *fpsc) {
33 sprintf(str, "%.1f", fpsc->fps);