ascii-chat
Binary v0.15.83-53-gb711d8720
Library lib/v0.3.2-701-gb711d8720
Video chat in your terminal
Loading...
Searching...
No Matches
fps_counter.c File Reference

FPS counter implementation using rolling-window timestamp buffer. More...

Go to the source code of this file.

Data Structures

struct  fps_counter_s
 Per-renderer timing state for the on-screen FPS overlay. More...

Macros

#define FPS_WINDOW_SIZE   30
 Number of frames to average over.

Functions

fps_counter_t * fps_counter_create (void)
 Create a new FPS counter.
void fps_counter_destroy (fps_counter_t *counter)
 Destroy FPS counter and free resources.
void fps_counter_tick (fps_counter_t *counter)
 Record a frame timestamp.
void fps_counter_reset (fps_counter_t *counter)
void fps_counter_tick_at (fps_counter_t *counter, uint64_t now)
float fps_counter_get (fps_counter_t *counter)
 Get the current FPS value.
float fps_counter_get_at (fps_counter_t *counter, uint64_t now)
bool fps_counter_set_visible (fps_counter_t *counter, bool visible)
void fps_counter_set_effective_fps (fps_counter_t *counter, unsigned int fps)
void fps_counter_frame_begin (fps_counter_t *counter, bool measure)
bool fps_counter_frame_begin_id (fps_counter_t *counter, uint64_t frame_id)
void fps_counter_write_begin (fps_counter_t *counter)
void fps_counter_write_end (fps_counter_t *counter, bool complete)
void fps_counter_frame_end (fps_counter_t *counter, uint64_t now)
void fps_counter_render (fps_counter_t *counter, int fd, int columns, bool redrawn)

Detailed Description

FPS counter implementation using rolling-window timestamp buffer.

Definition in file fps_counter.c.

Macro Definition Documentation

◆ FPS_WINDOW_SIZE

#define FPS_WINDOW_SIZE   30

Number of frames to average over.

Definition at line 17 of file fps_counter.c.

Referenced by fps_counter_get_at(), and fps_counter_tick_at().

Function Documentation

◆ fps_counter_frame_begin_id()

bool fps_counter_frame_begin_id ( fps_counter_t * counter,
uint64_t frame_id )

Count an acquired frame ID once, after its complete write. Zero denotes a UI-only redraw.

Definition at line 170 of file fps_counter.c.

170 {
171 if (!counter)
172 return false;
173 fps_counter_frame_begin(counter, frame_id && frame_id != counter->completed_frame_id);
174 counter->current_frame_id = frame_id;
175 return counter->measuring;
176}
void fps_counter_frame_begin(fps_counter_t *counter, bool measure)
uint64_t completed_frame_id
Definition fps_counter.c:35
uint64_t current_frame_id
Definition fps_counter.c:35

References fps_counter_s::completed_frame_id, fps_counter_s::current_frame_id, fps_counter_frame_begin(), and fps_counter_s::measuring.