Skip to content

Stack Depot

include/stack_depot.h View source View on GitHub
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

§ struct list_node hash_list
§ refcount_t refcount
§ size_t num_entries
§ uint32_t hash
§ uintptr_t entries[STACK_TRACE_MAX_DEPTH]
TODO

Different const for this

struct stack_depot_record_chain (2 fields) source
§ struct list_head list
§ struct spinlock lock
struct stack_depot_globals (3 fields) source
§ uint32_t starting_seed
§ atomic_size_t num_records
uint32_t stack_depot_hash(uintptr_t *entries, size_t num_entries)
source
void stack_depot_init(void)
source
stack_handle_t stack_depot_save(
    uintptr_t *entries,
    size_t num_entries,
    enum alloc_flags flags
)
source
struct stack_depot_record * stack_depot_get_record(stack_handle_t key)
source
size_t stack_depot_read(stack_handle_t key, uintptr_t *entries)
source
void stack_depot_print(stack_handle_t key)
source
void stack_depot_putref(stack_handle_t key)
source
stack_handle_t stack_depot_save_current(void)
source
size_t stack_depot_get_record_count(void)
source
extern struct stack_depot_globals stack_depot_global
source
#define STACK_DEPOT_HASH_SIZE 2048
source
#define STACK_DEPOT_ALLOW_ALLOC_FLAG ALLOC_FLAG_AVAIL_BIT(0)
source
TODO

Someday we’ll implement fixed_size_range support for this