Skip to content

Stack Depot

include/stack_depot.h View source View on GitHub
struct stack_depot_record {
    struct list_head  hash_list;
    refcount_t        refcount;
    size_t            num_entries;
    uint32_t          hash;
    uintptr_t         entries[STACK_TRACE_MAX_DEPTH];
};
struct stack_depot_record_chain {
    struct list_head  list;
    struct spinlock   lock;
};
struct stack_depot_globals {
    uint32_t                         starting_seed;
    struct stack_depot_record_chain  chains[STACK_DEPOT_HASH_SIZE];
    _Atomic size_t                   num_records;
};
uint32_t stack_depot_hash(uintptr_t *entries, size_t num_entries);
void stack_depot_init();
stack_handle_t stack_depot_save(uintptr_t *entries, size_t num_entries, enum alloc_flags flags);
struct stack_depot_record * stack_depot_get_record(stack_handle_t key);
size_t stack_depot_read(stack_handle_t key, uintptr_t *entries);
void stack_depot_print(stack_handle_t key);
void stack_depot_put(stack_handle_t key);
stack_handle_t stack_depot_save_current();
size_t stack_depot_get_record_count();
extern struct stack_depot_globals stack_depot_global;
#define STACK_DEPOT_HASH_SIZE 2048
#define STACK_DEPOT_ALLOW_ALLOC_FLAG ALLOC_FLAG_AVAIL_BIT(0)