ascii-chat 0.11.33
Video chat in your terminal
Loading...
Searching...
No Matches
buffer_pool Struct Reference

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

#include <include/ascii-chat/buffer_pool.h>

Data Fields

atomic_ptr_t free_list
 Lock-free stack of available buffers (void* cast from buffer_node_t*)
 
mutex_t shrink_mutex
 Only used for shrinking.
 
size_t max_bytes
 Maximum total bytes allowed.
 
uint64_t shrink_delay_ns
 Time before unused buffers freed (nanoseconds)
 
Atomic counters @{
atomic_t current_bytes
 Total bytes in pool (stored as uint64_t)
 
atomic_t used_bytes
 Bytes currently in use (stored as uint64_t)
 
atomic_t peak_bytes
 Peak bytes in use (stored as uint64_t)
 
atomic_t peak_pool_bytes
 Peak bytes in pool (stored as uint64_t)
 
atomic_t hits
 Allocations from free list.
 
atomic_t allocs
 New buffer allocations.
 
atomic_t returns
 Buffers returned to free list.
 
atomic_t shrink_freed
 Buffers freed by shrink.
 
atomic_t malloc_fallbacks
 Allocations that bypassed pool.
 

Detailed Description

Unified buffer pool with lock-free fast path.

Definition at line 85 of file buffer_pool.h.

Field Documentation

◆ allocs

atomic_t buffer_pool::allocs

New buffer allocations.

Definition at line 99 of file buffer_pool.h.

Referenced by buffer_pool_alloc(), buffer_pool_create(), and buffer_pool_log_stats().

◆ current_bytes

atomic_t buffer_pool::current_bytes

Total bytes in pool (stored as uint64_t)

Definition at line 93 of file buffer_pool.h.

Referenced by buffer_pool_alloc(), buffer_pool_create(), buffer_pool_get_stats(), buffer_pool_log_stats(), and buffer_pool_shrink().

◆ free_list

atomic_ptr_t buffer_pool::free_list

Lock-free stack of available buffers (void* cast from buffer_node_t*)

Definition at line 86 of file buffer_pool.h.

Referenced by buffer_pool_alloc(), buffer_pool_create(), buffer_pool_destroy(), buffer_pool_free(), buffer_pool_shrink(), node_pool_create(), node_pool_get(), and node_pool_put().

◆ hits

atomic_t buffer_pool::hits

Allocations from free list.

Definition at line 98 of file buffer_pool.h.

Referenced by buffer_pool_alloc(), buffer_pool_create(), and buffer_pool_log_stats().

◆ malloc_fallbacks

atomic_t buffer_pool::malloc_fallbacks

Allocations that bypassed pool.

Definition at line 102 of file buffer_pool.h.

Referenced by buffer_pool_alloc(), buffer_pool_create(), and buffer_pool_log_stats().

◆ max_bytes

size_t buffer_pool::max_bytes

Maximum total bytes allowed.

Definition at line 89 of file buffer_pool.h.

Referenced by buffer_pool_create(), and buffer_pool_log_stats().

◆ peak_bytes

atomic_t buffer_pool::peak_bytes

Peak bytes in use (stored as uint64_t)

Definition at line 95 of file buffer_pool.h.

Referenced by buffer_pool_alloc(), buffer_pool_create(), and buffer_pool_log_stats().

◆ peak_pool_bytes

atomic_t buffer_pool::peak_pool_bytes

Peak bytes in pool (stored as uint64_t)

Definition at line 96 of file buffer_pool.h.

Referenced by buffer_pool_alloc(), buffer_pool_create(), and buffer_pool_log_stats().

◆ returns

atomic_t buffer_pool::returns

Buffers returned to free list.

Definition at line 100 of file buffer_pool.h.

Referenced by buffer_pool_create(), buffer_pool_free(), and buffer_pool_log_stats().

◆ shrink_delay_ns

uint64_t buffer_pool::shrink_delay_ns

Time before unused buffers freed (nanoseconds)

Definition at line 90 of file buffer_pool.h.

Referenced by buffer_pool_create(), and buffer_pool_shrink().

◆ shrink_freed

atomic_t buffer_pool::shrink_freed

Buffers freed by shrink.

Definition at line 101 of file buffer_pool.h.

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

◆ shrink_mutex

mutex_t buffer_pool::shrink_mutex

Only used for shrinking.

Definition at line 87 of file buffer_pool.h.

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

◆ used_bytes

atomic_t buffer_pool::used_bytes

Bytes currently in use (stored as uint64_t)

Definition at line 94 of file buffer_pool.h.

Referenced by buffer_pool_alloc(), buffer_pool_create(), buffer_pool_free(), buffer_pool_get_stats(), and buffer_pool_log_stats().


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