blob: e9bd5e882f38e0c1be8bc47f3b475487d87a1d04 [file] [log] [blame]
Frederic Weisbecker8cb76d92009-06-26 16:28:00 +02001#ifndef __PERF_CALLCHAIN_H
2#define __PERF_CALLCHAIN_H
3
4#include "../perf.h"
Arnaldo Carvalho de Melo5da50252009-07-01 14:46:08 -03005#include <linux/list.h>
Arnaldo Carvalho de Melo43cbcd82009-07-01 12:28:37 -03006#include <linux/rbtree.h>
Frederic Weisbecker44249612009-07-01 05:35:14 +02007#include "symbol.h"
Frederic Weisbecker8cb76d92009-06-26 16:28:00 +02008
9
10struct callchain_node {
11 struct callchain_node *parent;
12 struct list_head brothers;
Ingo Molnarf37a2912009-07-01 12:37:06 +020013 struct list_head children;
14 struct list_head val;
Frederic Weisbecker8cb76d92009-06-26 16:28:00 +020015 struct rb_node rb_node;
Ingo Molnarf37a2912009-07-01 12:37:06 +020016 unsigned int val_nr;
17 u64 hit;
Frederic Weisbecker8cb76d92009-06-26 16:28:00 +020018};
19
20struct callchain_list {
Ingo Molnarf37a2912009-07-01 12:37:06 +020021 u64 ip;
Frederic Weisbecker44249612009-07-01 05:35:14 +020022 struct symbol *sym;
Frederic Weisbecker8cb76d92009-06-26 16:28:00 +020023 struct list_head list;
24};
25
26static 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 Weisbecker44249612009-07-01 05:35:14 +020033void append_chain(struct callchain_node *root, struct ip_callchain *chain,
34 struct symbol **syms);
Frederic Weisbecker8cb76d92009-06-26 16:28:00 +020035void sort_chain_to_rbtree(struct rb_root *rb_root, struct callchain_node *node);
36#endif