Frederic Weisbecker | 8cb76d9 | 2009-06-26 16:28:00 +0200 | [diff] [blame] | 1 | #ifndef __PERF_CALLCHAIN_H |
| 2 | #define __PERF_CALLCHAIN_H |
| 3 | |
| 4 | #include "../perf.h" |
Arnaldo Carvalho de Melo | 5da5025 | 2009-07-01 14:46:08 -0300 | [diff] [blame^] | 5 | #include <linux/list.h> |
Arnaldo Carvalho de Melo | 43cbcd8 | 2009-07-01 12:28:37 -0300 | [diff] [blame] | 6 | #include <linux/rbtree.h> |
Frederic Weisbecker | 4424961 | 2009-07-01 05:35:14 +0200 | [diff] [blame] | 7 | #include "symbol.h" |
Frederic Weisbecker | 8cb76d9 | 2009-06-26 16:28:00 +0200 | [diff] [blame] | 8 | |
| 9 | |
| 10 | struct callchain_node { |
| 11 | struct callchain_node *parent; |
| 12 | struct list_head brothers; |
Ingo Molnar | f37a291 | 2009-07-01 12:37:06 +0200 | [diff] [blame] | 13 | struct list_head children; |
| 14 | struct list_head val; |
Frederic Weisbecker | 8cb76d9 | 2009-06-26 16:28:00 +0200 | [diff] [blame] | 15 | struct rb_node rb_node; |
Ingo Molnar | f37a291 | 2009-07-01 12:37:06 +0200 | [diff] [blame] | 16 | unsigned int val_nr; |
| 17 | u64 hit; |
Frederic Weisbecker | 8cb76d9 | 2009-06-26 16:28:00 +0200 | [diff] [blame] | 18 | }; |
| 19 | |
| 20 | struct callchain_list { |
Ingo Molnar | f37a291 | 2009-07-01 12:37:06 +0200 | [diff] [blame] | 21 | u64 ip; |
Frederic Weisbecker | 4424961 | 2009-07-01 05:35:14 +0200 | [diff] [blame] | 22 | struct symbol *sym; |
Frederic Weisbecker | 8cb76d9 | 2009-06-26 16:28:00 +0200 | [diff] [blame] | 23 | struct list_head list; |
| 24 | }; |
| 25 | |
| 26 | static inline void callchain_init(struct callchain_node *node) |
| 27 | { |
| 28 | INIT_LIST_HEAD(&node->brothers); |
| 29 | INIT_LIST_HEAD(&node->children); |
| 30 | INIT_LIST_HEAD(&node->val); |
| 31 | } |
| 32 | |
Frederic Weisbecker | 4424961 | 2009-07-01 05:35:14 +0200 | [diff] [blame] | 33 | void append_chain(struct callchain_node *root, struct ip_callchain *chain, |
| 34 | struct symbol **syms); |
Frederic Weisbecker | 8cb76d9 | 2009-06-26 16:28:00 +0200 | [diff] [blame] | 35 | void sort_chain_to_rbtree(struct rb_root *rb_root, struct callchain_node *node); |
| 36 | #endif |