ea332e56e4582d565a7975208328b9d9b60b8d22
[safe/jmp/linux-2.6] / tools / perf / util / symbol.h
1 #ifndef _PERF_SYMBOL_
2 #define _PERF_SYMBOL_ 1
3
4 #include <linux/types.h>
5 #include "../types.h"
6 #include "list.h"
7 #include "rbtree.h"
8
9 struct symbol {
10         struct rb_node  rb_node;
11         u64             start;
12         u64             end;
13         u64             obj_start;
14         u64             hist_sum;
15         u64             *hist;
16         void            *priv;
17         char            name[0];
18 };
19
20 struct dso {
21         struct list_head node;
22         struct rb_root   syms;
23         unsigned int     sym_priv_size;
24         struct symbol    *(*find_symbol)(struct dso *, u64 ip);
25         char             name[0];
26 };
27
28 const char *sym_hist_filter;
29
30 typedef int (*symbol_filter_t)(struct dso *self, struct symbol *sym);
31
32 struct dso *dso__new(const char *name, unsigned int sym_priv_size);
33 void dso__delete(struct dso *self);
34
35 static inline void *dso__sym_priv(struct dso *self, struct symbol *sym)
36 {
37         return ((void *)sym) - self->sym_priv_size;
38 }
39
40 struct symbol *dso__find_symbol(struct dso *self, u64 ip);
41
42 int dso__load_kernel(struct dso *self, const char *vmlinux,
43                      symbol_filter_t filter, int verbose);
44 int dso__load(struct dso *self, symbol_filter_t filter, int verbose);
45
46 size_t dso__fprintf(struct dso *self, FILE *fp);
47
48 void symbol__init(void);
49 #endif /* _PERF_SYMBOL_ */