1 #ifndef __PERF_CALLCHAIN_H
2 #define __PERF_CALLCHAIN_H
5 #include <linux/list.h>
6 #include <linux/rbtree.h>
16 struct callchain_node {
17 struct callchain_node *parent;
18 struct list_head brothers;
19 struct list_head children;
21 struct rb_node rb_node; /* to sort nodes in an rbtree */
22 struct rb_root rb_root; /* sorted tree of children */
28 struct callchain_param;
30 typedef void (*sort_chain_func_t)(struct rb_root *, struct callchain_node *,
31 u64, struct callchain_param *);
33 struct callchain_param {
36 sort_chain_func_t sort;
39 struct callchain_list {
42 struct list_head list;
45 static inline void callchain_init(struct callchain_node *node)
47 INIT_LIST_HEAD(&node->brothers);
48 INIT_LIST_HEAD(&node->children);
49 INIT_LIST_HEAD(&node->val);
52 static inline u64 cumul_hits(struct callchain_node *node)
54 return node->hit + node->children_hit;
57 int register_callchain_param(struct callchain_param *param);
58 void append_chain(struct callchain_node *root, struct ip_callchain *chain,
59 struct symbol **syms);