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> |
Paul Mackerras | 9cffa8d | 2009-06-19 22:21:42 +1000 | [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; |
Arnaldo Carvalho de Melo | 0085c954 | 2009-05-28 14:55:13 -0300 | [diff] [blame] | 23 | unsigned int sym_priv_size; |
Paul Mackerras | 9cffa8d | 2009-06-19 22:21:42 +1000 | [diff] [blame^] | 24 | struct symbol *(*find_symbol)(struct dso *, u64 ip); |
Arnaldo Carvalho de Melo | a2928c4 | 2009-05-28 14:55:04 -0300 | [diff] [blame] | 25 | char name[0]; |
| 26 | }; |
| 27 | |
Ingo Molnar | 0b73da3 | 2009-06-06 15:48:52 +0200 | [diff] [blame] | 28 | const char *sym_hist_filter; |
| 29 | |
Arnaldo Carvalho de Melo | 69ee69f | 2009-05-28 14:55:26 -0300 | [diff] [blame] | 30 | typedef int (*symbol_filter_t)(struct dso *self, struct symbol *sym); |
| 31 | |
Arnaldo Carvalho de Melo | 0085c954 | 2009-05-28 14:55:13 -0300 | [diff] [blame] | 32 | 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] | 33 | void dso__delete(struct dso *self); |
| 34 | |
Arnaldo Carvalho de Melo | 0085c954 | 2009-05-28 14:55:13 -0300 | [diff] [blame] | 35 | static inline void *dso__sym_priv(struct dso *self, struct symbol *sym) |
| 36 | { |
| 37 | return ((void *)sym) - self->sym_priv_size; |
| 38 | } |
| 39 | |
Paul Mackerras | 9cffa8d | 2009-06-19 22:21:42 +1000 | [diff] [blame^] | 40 | struct symbol *dso__find_symbol(struct dso *self, u64 ip); |
Arnaldo Carvalho de Melo | a2928c4 | 2009-05-28 14:55:04 -0300 | [diff] [blame] | 41 | |
Arnaldo Carvalho de Melo | 69ee69f | 2009-05-28 14:55:26 -0300 | [diff] [blame] | 42 | int dso__load_kernel(struct dso *self, const char *vmlinux, |
Ingo Molnar | bd74137 | 2009-06-04 14:13:04 +0200 | [diff] [blame] | 43 | symbol_filter_t filter, int verbose); |
| 44 | 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] | 45 | |
| 46 | size_t dso__fprintf(struct dso *self, FILE *fp); |
| 47 | |
| 48 | void symbol__init(void); |
| 49 | #endif /* _PERF_SYMBOL_ */ |