49 #ifndef CSPROF_TRAMPOLINE_BACKEND 55 cache_set(hpcrun_cct_t* x,
unsigned int depth,
void* ip,
56 hpcrun_cct_node_t*
node)
61 if (depth > x->cache_len) {
66 i = x->cache_len - depth;
68 x->cache_nodes[i] =
node;
77 if (depth > x->cache_len) {
80 x->cache_top = x->cache_len - depth;
89 if (depth > x->cache_len) {
91 void** old_bt = x->cache_bt;
92 hpcrun_cct_node_t** old_nodes = x->cache_nodes;
93 unsigned int old_len = x->cache_len, padding = 0;
95 x->cache_len = x->cache_len * 2;
96 if (depth > x->cache_len) { x->cache_len = depth; }
101 DBGMSG_PUB(CSPROF_DBG_CCT_INSERTION,
102 "resizing cct cache: %d -> %d length", old_len, x->cache_len);
104 padding = x->cache_len - old_len;
105 memcpy(x->cache_bt + padding, old_bt,
sizeof(
void*) * old_len);
106 memcpy(x->cache_nodes + padding, old_nodes,
sizeof(
void*) * old_len);
107 x->cache_top = x->cache_top + padding;
120 unsigned int i = x->cache_len - depth;
121 if (depth > x->cache_len || i < x->cache_top) {
return NULL; }
122 return x->cache_bt[i];
128 static hpcrun_cct_node_t*
131 unsigned int i = x->cache_len - depth;
132 if (depth > x->cache_len || i < x->cache_top) {
return NULL; }
133 return x->cache_nodes[i];
static int cache_set_depth(hpcrun_cct_t *x, unsigned int depth)
static int cache_set(hpcrun_cct_t *x, unsigned int depth, void *ip, hpcrun_cct_node_t *node)
static int cache_resize(hpcrun_cct_t *x, unsigned int depth)
static hpcrun_cct_node_t * cache_get_node(hpcrun_cct_t *x, unsigned int depth)
void * hpcrun_malloc(size_t size)
static void * cache_get_bt(hpcrun_cct_t *x, unsigned int depth)