perf tools: callchain: Fix spurious 'perf report' warnings: ignore empty callchains
[linux-2.6-block.git] / tools / perf / util / callchain.h
CommitLineData
8cb76d99
FW
1#ifndef __PERF_CALLCHAIN_H
2#define __PERF_CALLCHAIN_H
3
4#include "../perf.h"
5da50258 5#include <linux/list.h>
43cbcd8a 6#include <linux/rbtree.h>
4424961a 7#include "symbol.h"
8cb76d99 8
4eb3e478 9enum chain_mode {
805d127d
FW
10 CHAIN_FLAT,
11 CHAIN_GRAPH_ABS,
12 CHAIN_GRAPH_REL
4eb3e478 13};
8cb76d99
FW
14
15struct callchain_node {
16 struct callchain_node *parent;
17 struct list_head brothers;
f37a291c
IM
18 struct list_head children;
19 struct list_head val;
4eb3e478
FW
20 struct rb_node rb_node; /* to sort nodes in an rbtree */
21 struct rb_root rb_root; /* sorted tree of children */
f37a291c
IM
22 unsigned int val_nr;
23 u64 hit;
1953287b 24 u64 children_hit;
8cb76d99
FW
25};
26
805d127d
FW
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;
36};
37
8cb76d99 38struct callchain_list {
f37a291c 39 u64 ip;
4424961a 40 struct symbol *sym;
8cb76d99
FW
41 struct list_head list;
42};
43
44static inline void callchain_init(struct callchain_node *node)
45{
46 INIT_LIST_HEAD(&node->brothers);
47 INIT_LIST_HEAD(&node->children);
48 INIT_LIST_HEAD(&node->val);
49}
50
1953287b
FW
51static inline u64 cumul_hits(struct callchain_node *node)
52{
53 return node->hit + node->children_hit;
54}
55
805d127d 56int register_callchain_param(struct callchain_param *param);
4424961a
FW
57void append_chain(struct callchain_node *root, struct ip_callchain *chain,
58 struct symbol **syms);
8cb76d99 59#endif