const cache_policy_t *const g_cb_policies[]
The registered policy table (defined in src/policies.c).
int cb_replay(const cache_policy_t *pol, const cb_trace_t *trace, uint32_t capacity, cb_workspace_t *workspace, cb_result_t *out)
Replay an access trace through one policy at a fixed capacity.
const cache_policy_t g_cb_policy_srrip
SRRIP: the 2-bit re-reference-interval candidate (src/policy_scanresist.c).
size_t cb_replay_workspace_required(const cache_policy_t *pol, uint32_t capacity)
Return the exact caller workspace required by one replay.
struct cb_trace cb_trace_t
const cache_policy_t g_cb_policy_slru
Segmented-LRU: the scan-resistant candidate (src/policy_scanresist.c).
const uint32_t g_cb_policy_count
Number of entries in g_cb_policies.
The replacement-policy DIP seam (the eventual firmware Layer-2 seam).
size_t meta_bytes
Per-frame metadata actually used (RAM cost).
void(* on_access)(cb_cache_t *c, uint32_t frame)
A resident key was just hit at frame (update recency/freq).
const char * name
Policy name for the report table.
void(* on_insert)(cb_cache_t *c, uint32_t frame)
frame was just (re)populated with a freshly-loaded key.
void(* deinit)(cb_cache_t *c)
Release policy state.
size_t state_base_bytes
Fixed policy workspace bytes.
size_t state_frame_bytes
Additional bytes per frame.
uint32_t(* pick_victim)(cb_cache_t *c, uint32_t *scanned)
Choose a live frame to evict.
int(* init)(cb_cache_t *c)
Allocate + init policy state for a cb_cache_t.
The fixed-capacity frame cache a policy manages.
cb_frame_t * frames
capacity frame slots.
size_t policy_workspace_bytes
Bytes available at the storage.
void * policy_data
Policy-private state (rings, stacks, sketch).
uint32_t capacity
Number of frame slots (the RAM budget knob).
void * policy_workspace
Caller-provided policy-state storage.
One frame slot in the fixed page cache.
cb_key_t key
Resident key, valid only when live is true.
uint8_t meta[16]
Per-policy scratch (ref bits, RRPV, list links).
bool live
true: slot holds a resident page.
A cache key: one (object, page) the reader's vm_get touches.
uint32_t object_id
Opaque object handle (book / archive / font).
uint32_t page
Page index within the object (offset / page-size).
Per-(policy, trace, size) result row.
uint64_t hits
Resident-set hits.
uint32_t worst_scan
Max frames scanned in any eviction.
uint64_t evictions
pick_victim calls.
uint64_t total_scan
Sum of frames scanned (avg proxy).
uint64_t accesses
Total accesses replayed.
Named resettable trace; captured bytes remain owned by the caller.
Caller-owned replay workspace and exact capacity diagnostics.
uint8_t * data
Aligned writable storage.
size_t required
Exact bytes required by the latest request.
size_t high_water
Largest successfully provisioned request.
size_t capacity
Supplied bytes.