Stack Depot
include/stack_depot.h View source View on GitHubStructs
Section titled “Structs”stack_depot_record
Section titled “stack_depot_record” struct stack_depot_record (5 fields) source
This is a single item in the hash table, and the idea here is that when the current stack matches one of these, we return the existing one
§
refcount_t refcount §
size_t num_entries §
uint32_t hash §
uintptr_t entries[STACK_TRACE_MAX_DEPTH] TODO
Different const for this
stack_depot_record_chain
Section titled “stack_depot_record_chain”stack_depot_globals
Section titled “stack_depot_globals” struct stack_depot_globals (3 fields) source
§
uint32_t starting_seed §
struct stack_depot_record_chain chains[STACK_DEPOT_HASH_SIZE] §
atomic_size_t num_records Functions
Section titled “Functions”stack_depot_hash
Section titled “stack_depot_hash”uint32_t stack_depot_hash(uintptr_t *entries, size_t num_entries) source stack_depot_init
Section titled “stack_depot_init”void stack_depot_init(void) source stack_depot_save
Section titled “stack_depot_save”stack_handle_t stack_depot_save(
uintptr_t *entries,
size_t num_entries,
enum alloc_flags flags
) source stack_depot_get_record
Section titled “stack_depot_get_record”struct stack_depot_record * stack_depot_get_record(stack_handle_t key) source stack_depot_read
Section titled “stack_depot_read”size_t stack_depot_read(stack_handle_t key, uintptr_t *entries) source stack_depot_print
Section titled “stack_depot_print”void stack_depot_print(stack_handle_t key) source stack_depot_putref
Section titled “stack_depot_putref”void stack_depot_putref(stack_handle_t key) source stack_depot_save_current
Section titled “stack_depot_save_current”stack_handle_t stack_depot_save_current(void) source stack_depot_get_record_count
Section titled “stack_depot_get_record_count”size_t stack_depot_get_record_count(void) source Variables
Section titled “Variables”stack_depot_global
Section titled “stack_depot_global”extern struct stack_depot_globals stack_depot_global source Macros
Section titled “Macros”STACK_DEPOT_HASH_SIZE
Section titled “STACK_DEPOT_HASH_SIZE”#define STACK_DEPOT_HASH_SIZE 2048 source STACK_DEPOT_ALLOW_ALLOC_FLAG
Section titled “STACK_DEPOT_ALLOW_ALLOC_FLAG”#define STACK_DEPOT_ALLOW_ALLOC_FLAG ALLOC_FLAG_AVAIL_BIT(0) source TODO
Someday we’ll implement fixed_size_range support for this