diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2009-06-26 10:28:00 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-06-26 10:47:00 -0400 |
commit | 8cb76d99d715741637b6d0884f389e17e9cb05d2 (patch) | |
tree | b4a66b3688390bc2571e4ddd0fa16a1cc0515c71 /tools/perf/util/callchain.h | |
parent | 3928ddbe994cce1da1b6365b0db04d5765f254f4 (diff) |
perf_counter tools: Prepare a small callchain framework
We plan to display the callchains depending on some user-configurable
parameters.
To gather the callchains stats from the recorded stream in a fast way,
this patch introduces an ad hoc radix tree adapted for callchains and also
a rbtree to sort these callchains once we have gathered every events
from the stream.
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1246026481-8314-2-git-send-email-fweisbec@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/util/callchain.h')
-rw-r--r-- | tools/perf/util/callchain.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tools/perf/util/callchain.h b/tools/perf/util/callchain.h new file mode 100644 index 000000000000..fa1cd2f71fd3 --- /dev/null +++ b/tools/perf/util/callchain.h | |||
@@ -0,0 +1,33 @@ | |||
1 | #ifndef __PERF_CALLCHAIN_H | ||
2 | #define __PERF_CALLCHAIN_H | ||
3 | |||
4 | #include "../perf.h" | ||
5 | #include "list.h" | ||
6 | #include "rbtree.h" | ||
7 | |||
8 | |||
9 | struct callchain_node { | ||
10 | struct callchain_node *parent; | ||
11 | struct list_head brothers; | ||
12 | struct list_head children; | ||
13 | struct list_head val; | ||
14 | struct rb_node rb_node; | ||
15 | int val_nr; | ||
16 | int hit; | ||
17 | }; | ||
18 | |||
19 | struct callchain_list { | ||
20 | unsigned long ip; | ||
21 | struct list_head list; | ||
22 | }; | ||
23 | |||
24 | static inline void callchain_init(struct callchain_node *node) | ||
25 | { | ||
26 | INIT_LIST_HEAD(&node->brothers); | ||
27 | INIT_LIST_HEAD(&node->children); | ||
28 | INIT_LIST_HEAD(&node->val); | ||
29 | } | ||
30 | |||
31 | void append_chain(struct callchain_node *root, struct ip_callchain *chain); | ||
32 | void sort_chain_to_rbtree(struct rb_root *rb_root, struct callchain_node *node); | ||
33 | #endif | ||