aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/callchain.h
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/callchain.h')
-rw-r--r--tools/perf/util/callchain.h41
1 files changed, 31 insertions, 10 deletions
diff --git a/tools/perf/util/callchain.h b/tools/perf/util/callchain.h
index fa1cd2f71fd3..7812122bea1d 100644
--- a/tools/perf/util/callchain.h
+++ b/tools/perf/util/callchain.h
@@ -2,22 +2,42 @@
2#define __PERF_CALLCHAIN_H 2#define __PERF_CALLCHAIN_H
3 3
4#include "../perf.h" 4#include "../perf.h"
5#include "list.h" 5#include <linux/list.h>
6#include "rbtree.h" 6#include <linux/rbtree.h>
7#include "symbol.h"
7 8
9enum chain_mode {
10 CHAIN_FLAT,
11 CHAIN_GRAPH_ABS,
12 CHAIN_GRAPH_REL
13};
8 14
9struct callchain_node { 15struct callchain_node {
10 struct callchain_node *parent; 16 struct callchain_node *parent;
11 struct list_head brothers; 17 struct list_head brothers;
12 struct list_head children; 18 struct list_head children;
13 struct list_head val; 19 struct list_head val;
14 struct rb_node rb_node; 20 struct rb_node rb_node; /* to sort nodes in an rbtree */
15 int val_nr; 21 struct rb_root rb_root; /* sorted tree of children */
16 int hit; 22 unsigned int val_nr;
23 u64 hit;
24 u64 cumul_hit; /* hit + hits of children */
25};
26
27struct callchain_param;
28
29typedef void (*sort_chain_func_t)(struct rb_root *, struct callchain_node *,
30 u64, struct callchain_param *);
31
32struct callchain_param {
33 enum chain_mode mode;
34 double min_percent;
35 sort_chain_func_t sort;
17}; 36};
18 37
19struct callchain_list { 38struct callchain_list {
20 unsigned long ip; 39 u64 ip;
40 struct symbol *sym;
21 struct list_head list; 41 struct list_head list;
22}; 42};
23 43
@@ -28,6 +48,7 @@ static inline void callchain_init(struct callchain_node *node)
28 INIT_LIST_HEAD(&node->val); 48 INIT_LIST_HEAD(&node->val);
29} 49}
30 50
31void append_chain(struct callchain_node *root, struct ip_callchain *chain); 51int register_callchain_param(struct callchain_param *param);
32void sort_chain_to_rbtree(struct rb_root *rb_root, struct callchain_node *node); 52void append_chain(struct callchain_node *root, struct ip_callchain *chain,
53 struct symbol **syms);
33#endif 54#endif