fplayer
C99 Falcon Sequence (fseq) file player for Light-O-Rama hardware (like xLights)
Loading...
Searching...
No Matches
sleep.h File Reference

Adaptive sleep time controller for frame rate control. More...

#include <stdint.h>
Include dependency graph for sleep.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int Sleep_init (struct sleep_coll_s **coll)
 Allocates and initializes a new sleep collector with default values.
 
int64_t Sleep_average (const struct sleep_coll_s *coll)
 Returns the average sleep time in nanoseconds from the given sleep collector. This is calculated by summing all sleep times in the collector and dividing by the number of samples.
 
void Sleep_do (struct sleep_coll_s *coll, uint32_t ms)
 Sleeps for the given number of milliseconds using incremental sleep calls that estimate the time remaining to sleep using historical sleep data. The remaining sleep time is performed using a primitive spin lock to ensure the executed sleep time is accurate.
 

Detailed Description

Adaptive sleep time controller for frame rate control.

Function Documentation

◆ Sleep_average()

int64_t Sleep_average ( const struct sleep_coll_s * coll)

Returns the average sleep time in nanoseconds from the given sleep collector. This is calculated by summing all sleep times in the collector and dividing by the number of samples.

Parameters
colltarget sleep collector
Returns
the average sleep time in nanoseconds
Here is the caller graph for this function:

◆ Sleep_do()

void Sleep_do ( struct sleep_coll_s * coll,
uint32_t ms )

Sleeps for the given number of milliseconds using incremental sleep calls that estimate the time remaining to sleep using historical sleep data. The remaining sleep time is performed using a primitive spin lock to ensure the executed sleep time is accurate.

Parameters
colltarget sleep collector for recording historical sleep data
msnumber of milliseconds to sleep
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Sleep_init()

int Sleep_init ( struct sleep_coll_s ** coll)

Allocates and initializes a new sleep collector with default values.

Parameters
colltarget sleep collector
Returns
0 on success, a negative error code on failure
Here is the caller graph for this function: