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