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.h47
1 files changed, 37 insertions, 10 deletions
diff --git a/tools/perf/util/callchain.h b/tools/perf/util/callchain.h
index fa1cd2f71fd3..a926ae4f5a16 100644
--- a/tools/perf/util/callchain.h
+++ b/tools/perf/util/callchain.h
@@ -2,22 +2,43 @@
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_NONE,
11 CHAIN_FLAT,
12 CHAIN_GRAPH_ABS,
13 CHAIN_GRAPH_REL
14};
8 15
9struct callchain_node { 16struct callchain_node {
10 struct callchain_node *parent; 17 struct callchain_node *parent;
11 struct list_head brothers; 18 struct list_head brothers;
12 struct list_head children; 19 struct list_head children;
13 struct list_head val; 20 struct list_head val;
14 struct rb_node rb_node; 21 struct rb_node rb_node; /* to sort nodes in an rbtree */
15 int val_nr; 22 struct rb_root rb_root; /* sorted tree of children */
16 int hit; 23 unsigned int val_nr;
24 u64 hit;
25 u64 children_hit;
26};
27
28struct callchain_param;
29
30typedef void (*sort_chain_func_t)(struct rb_root *, struct callchain_node *,
31 u64, struct callchain_param *);
32
33struct callchain_param {
34 enum chain_mode mode;
35 double min_percent;
36 sort_chain_func_t sort;
17}; 37};
18 38
19struct callchain_list { 39struct callchain_list {
20 unsigned long ip; 40 u64 ip;
41 struct symbol *sym;
21 struct list_head list; 42 struct list_head list;
22}; 43};
23 44
@@ -28,6 +49,12 @@ static inline void callchain_init(struct callchain_node *node)
28 INIT_LIST_HEAD(&node->val); 49 INIT_LIST_HEAD(&node->val);
29} 50}
30 51
31void append_chain(struct callchain_node *root, struct ip_callchain *chain); 52static inline u64 cumul_hits(struct callchain_node *node)
32void sort_chain_to_rbtree(struct rb_root *rb_root, struct callchain_node *node); 53{
54 return node->hit + node->children_hit;
55}
56
57int register_callchain_param(struct callchain_param *param);
58void append_chain(struct callchain_node *root, struct ip_callchain *chain,
59 struct symbol **syms);
33#endif 60#endif