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

Unified buffer pool with lock-free fast path. More...

#include <lib/buffer_pool.h>

Public Member Functions

 _Atomic (buffer_node_t *) free_list
 Lock-free stack of available buffers.
 
Atomic counters @{
 _Atomic (size_t) current_bytes
 Total bytes in pool.
 
 _Atomic (size_t) used_bytes
 Bytes currently in use.
 
 _Atomic (size_t) peak_bytes
 Peak bytes in use.
 
 _Atomic (size_t) peak_pool_bytes
 Peak bytes in pool.
 
 _Atomic (uint64_t) hits
 Allocations from free list.
 
 _Atomic (uint64_t) allocs
 New buffer allocations.
 
 _Atomic (uint64_t) returns
 Buffers returned to free list.
 
 _Atomic (uint64_t) shrink_freed
 Buffers freed by shrink.
 
 _Atomic (uint64_t) malloc_fallbacks
 Allocations that bypassed pool.
 

Data Fields

mutex_t shrink_mutex
 Only used for shrinking.
 
size_t max_bytes
 Maximum total bytes allowed.
 
uint64_t shrink_delay_ms
 Time before unused buffers freed.
 

Detailed Description

Unified buffer pool with lock-free fast path.

Definition at line 90 of file buffer_pool.h.

Member Function Documentation

◆ _Atomic() [1/10]

buffer_pool::_Atomic ( buffer_node_t )

Lock-free stack of available buffers.

◆ _Atomic() [2/10]

buffer_pool::_Atomic ( size_t  )

Total bytes in pool.

◆ _Atomic() [3/10]

buffer_pool::_Atomic ( size_t  )

Peak bytes in use.

◆ _Atomic() [4/10]

buffer_pool::_Atomic ( size_t  )

Peak bytes in pool.

◆ _Atomic() [5/10]

buffer_pool::_Atomic ( size_t  )

Bytes currently in use.

◆ _Atomic() [6/10]

buffer_pool::_Atomic ( uint64_t  )

New buffer allocations.

◆ _Atomic() [7/10]

buffer_pool::_Atomic ( uint64_t  )

Allocations from free list.

◆ _Atomic() [8/10]

buffer_pool::_Atomic ( uint64_t  )

Allocations that bypassed pool.

◆ _Atomic() [9/10]

buffer_pool::_Atomic ( uint64_t  )

Buffers returned to free list.

◆ _Atomic() [10/10]

buffer_pool::_Atomic ( uint64_t  )

Buffers freed by shrink.

Field Documentation

◆ max_bytes

size_t buffer_pool::max_bytes

Maximum total bytes allowed.

Definition at line 94 of file buffer_pool.h.

Referenced by buffer_pool_create(), and buffer_pool_log_stats().

◆ shrink_delay_ms

uint64_t buffer_pool::shrink_delay_ms

Time before unused buffers freed.

Definition at line 95 of file buffer_pool.h.

Referenced by buffer_pool_create(), and buffer_pool_shrink().

◆ shrink_mutex

mutex_t buffer_pool::shrink_mutex

Only used for shrinking.

Definition at line 92 of file buffer_pool.h.

Referenced by buffer_pool_create(), buffer_pool_destroy(), and buffer_pool_shrink().


The documentation for this struct was generated from the following file: