Arnaldo Carvalho de Melo | a2928c4 | 2009-05-28 14:55:04 -0300 | [diff] [blame] | 1 | #ifndef _PERF_SYMBOL_ |
| 2 | #define _PERF_SYMBOL_ 1 |
| 3 | |
| 4 | #include <linux/types.h> |
Peter Zijlstra | 7c6a1c6 | 2009-06-25 17:05:54 +0200 | [diff] [blame] | 5 | #include "types.h" |
Arnaldo Carvalho de Melo | a2928c4 | 2009-05-28 14:55:04 -0300 | [diff] [blame] | 6 | #include "list.h" |
| 7 | #include "rbtree.h" |
| 8 | |
| 9 | struct symbol { |
| 10 | struct rb_node rb_node; |
Paul Mackerras | 9cffa8d | 2009-06-19 22:21:42 +1000 | [diff] [blame] | 11 | u64 start; |
| 12 | u64 end; |
| 13 | u64 obj_start; |
| 14 | u64 hist_sum; |
| 15 | u64 *hist; |
Frederic Weisbecker | 301406b | 2009-06-13 00:11:21 +0200 | [diff] [blame] | 16 | void *priv; |
Arnaldo Carvalho de Melo | a2928c4 | 2009-05-28 14:55:04 -0300 | [diff] [blame] | 17 | char name[0]; |
| 18 | }; |
| 19 | |
| 20 | struct dso { |
| 21 | struct list_head node; |
| 22 | struct rb_root syms; |
Paul Mackerras | 9cffa8d | 2009-06-19 22:21:42 +1000 | [diff] [blame] | 23 | struct symbol *(*find_symbol)(struct dso *, u64 ip); |
Arnaldo Carvalho de Melo | f5812a7 | 2009-06-30 11:43:17 -0300 | [diff] [blame] | 24 | unsigned int sym_priv_size; |
| 25 | unsigned char prelinked; |
Arnaldo Carvalho de Melo | a2928c4 | 2009-05-28 14:55:04 -0300 | [diff] [blame] | 26 | char name[0]; |
| 27 | }; |
| 28 | |
Ingo Molnar | 0b73da3 | 2009-06-06 15:48:52 +0200 | [diff] [blame] | 29 | const char *sym_hist_filter; |
| 30 | |
Arnaldo Carvalho de Melo | 69ee69f | 2009-05-28 14:55:26 -0300 | [diff] [blame] | 31 | typedef int (*symbol_filter_t)(struct dso *self, struct symbol *sym); |
| 32 | |
Arnaldo Carvalho de Melo | 0085c954 | 2009-05-28 14:55:13 -0300 | [diff] [blame] | 33 | struct dso *dso__new(const char *name, unsigned int sym_priv_size); |
Arnaldo Carvalho de Melo | a2928c4 | 2009-05-28 14:55:04 -0300 | [diff] [blame] | 34 | void dso__delete(struct dso *self); |
| 35 | |
Arnaldo Carvalho de Melo | 0085c954 | 2009-05-28 14:55:13 -0300 | [diff] [blame] | 36 | static inline void *dso__sym_priv(struct dso *self, struct symbol *sym) |
| 37 | { |
| 38 | return ((void *)sym) - self->sym_priv_size; |
| 39 | } |
| 40 | |
Paul Mackerras | 9cffa8d | 2009-06-19 22:21:42 +1000 | [diff] [blame] | 41 | struct symbol *dso__find_symbol(struct dso *self, u64 ip); |
Arnaldo Carvalho de Melo | a2928c4 | 2009-05-28 14:55:04 -0300 | [diff] [blame] | 42 | |
Arnaldo Carvalho de Melo | 69ee69f | 2009-05-28 14:55:26 -0300 | [diff] [blame] | 43 | int dso__load_kernel(struct dso *self, const char *vmlinux, |
Ingo Molnar | bd74137 | 2009-06-04 14:13:04 +0200 | [diff] [blame] | 44 | symbol_filter_t filter, int verbose); |
| 45 | int dso__load(struct dso *self, symbol_filter_t filter, int verbose); |
Arnaldo Carvalho de Melo | a2928c4 | 2009-05-28 14:55:04 -0300 | [diff] [blame] | 46 | |
| 47 | size_t dso__fprintf(struct dso *self, FILE *fp); |
| 48 | |
| 49 | void symbol__init(void); |
| 50 | #endif /* _PERF_SYMBOL_ */ |