Lines Matching +full:ip +full:- +full:blocks
1 // SPDX-License-Identifier: GPL-2.0-only
3 * call-path.h: Manipulate a tree data structure containing function call paths
12 #include "call-path.h"
15 struct symbol *sym, u64 ip, bool in_kernel) in call_path__init() argument
17 cp->parent = parent; in call_path__init()
18 cp->sym = sym; in call_path__init()
19 cp->ip = sym ? 0 : ip; in call_path__init()
20 cp->db_id = 0; in call_path__init()
21 cp->in_kernel = in_kernel; in call_path__init()
22 RB_CLEAR_NODE(&cp->rb_node); in call_path__init()
23 cp->children = RB_ROOT; in call_path__init()
33 call_path__init(&cpr->call_path, NULL, NULL, 0, false); in call_path_root__new()
34 INIT_LIST_HEAD(&cpr->blocks); in call_path_root__new()
42 list_for_each_entry_safe(pos, n, &cpr->blocks, node) { in call_path_root__free()
43 list_del_init(&pos->node); in call_path_root__free()
51 struct symbol *sym, u64 ip, in call_path__new() argument
58 if (cpr->next < cpr->sz) { in call_path__new()
59 cpb = list_last_entry(&cpr->blocks, struct call_path_block, in call_path__new()
65 list_add_tail(&cpb->node, &cpr->blocks); in call_path__new()
66 cpr->sz += CALL_PATH_BLOCK_SIZE; in call_path__new()
69 n = cpr->next++ & CALL_PATH_BLOCK_MASK; in call_path__new()
70 cp = &cpb->cp[n]; in call_path__new()
72 call_path__init(cp, parent, sym, ip, in_kernel); in call_path__new()
79 struct symbol *sym, u64 ip, u64 ks) in call_path__findnew() argument
84 bool in_kernel = ip >= ks; in call_path__findnew()
87 ip = 0; in call_path__findnew()
90 return call_path__new(cpr, parent, sym, ip, in_kernel); in call_path__findnew()
92 p = &parent->children.rb_node; in call_path__findnew()
97 if (cp->sym == sym && cp->ip == ip) in call_path__findnew()
100 if (sym < cp->sym || (sym == cp->sym && ip < cp->ip)) in call_path__findnew()
101 p = &(*p)->rb_left; in call_path__findnew()
103 p = &(*p)->rb_right; in call_path__findnew()
106 cp = call_path__new(cpr, parent, sym, ip, in_kernel); in call_path__findnew()
110 rb_link_node(&cp->rb_node, node_parent, p); in call_path__findnew()
111 rb_insert_color(&cp->rb_node, &parent->children); in call_path__findnew()