ascii-chat 0.6.0
Real-time terminal-based video chat with ASCII art conversion
Loading...
Searching...
No Matches
time.h File Reference

⏱️ High-precision timing utilities using sokol_time.h and uthash More...

Go to the source code of this file.

Data Structures

struct  timer_record
 Individual timer record for a named timing operation. More...
 
struct  adaptive_sleep_config_t
 Configuration for adaptive sleep behavior. More...
 
struct  adaptive_sleep_state_t
 Runtime state for adaptive sleep. More...
 

Macros

#define START_TIMER(name_fmt, ...)
 Start a timer with formatted name.
 
#define STOP_TIMER(name_fmt, ...)
 Stop a timer with formatted name and return elapsed time.
 
#define NS_PER_US   1000.0
 
#define NS_PER_MS   1000000.0
 
#define NS_PER_SEC   1000000000.0
 
#define NS_PER_MIN   (NS_PER_SEC * 60.0)
 
#define NS_PER_HOUR   (NS_PER_MIN * 60.0)
 
#define NS_PER_DAY   (NS_PER_HOUR * 24.0)
 
#define NS_PER_YEAR   (NS_PER_DAY * 365.25)
 
#define STOP_TIMER_AND_LOG(timer_name, log_func, msg_fmt, ...)
 Stop a timer and log the result with a custom message.
 

Typedefs

typedef struct timer_record timer_record_t
 Individual timer record for a named timing operation.
 

Functions

bool timer_system_init (void)
 Initialize the timing system.
 
void timer_system_cleanup (void)
 Cleanup the timing system.
 
bool timer_start (const char *name)
 Start a named timer.
 
double timer_stop (const char *name)
 Stop a named timer and return elapsed time.
 
bool timer_is_initialized (void)
 Check if timing system is initialized.
 
int format_duration_ms (double milliseconds, char *buffer, size_t buffer_size)
 Format milliseconds as human-readable duration string.
 
int format_duration_ns (double nanoseconds, char *buffer, size_t buffer_size)
 Format nanoseconds as human-readable duration string.
 
int format_duration_s (double seconds, char *buffer, size_t buffer_size)
 Format seconds as human-readable duration string.
 
void adaptive_sleep_init (adaptive_sleep_state_t *state, const adaptive_sleep_config_t *config)
 Initialize adaptive sleep state with configuration.
 
uint64_t adaptive_sleep_calculate (adaptive_sleep_state_t *state, size_t queue_depth, size_t target_depth)
 Calculate adaptive sleep time based on queue depth.
 
void adaptive_sleep_do (adaptive_sleep_state_t *state, size_t queue_depth, size_t target_depth)
 Calculate sleep time and immediately sleep for that duration.
 

Detailed Description

⏱️ High-precision timing utilities using sokol_time.h and uthash

Definition in file time.h.