symbol.h 1.4 KB
Newer Older
1 2 3 4
#ifndef _PERF_SYMBOL_
#define _PERF_SYMBOL_ 1

#include <linux/types.h>
5
#include "types.h"
6
#include <linux/list.h>
7
#include <linux/rbtree.h>
8
#include "module.h"
9 10 11

struct symbol {
	struct rb_node	rb_node;
12 13 14 15 16
	u64		start;
	u64		end;
	u64		obj_start;
	u64		hist_sum;
	u64		*hist;
17
	struct module	*module;
18
	void		*priv;
19 20 21 22 23 24
	char		name[0];
};

struct dso {
	struct list_head node;
	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
	unsigned char	 slen_calculated;
29
	unsigned char	 origin;
30 31 32
	char		 name[0];
};

33 34
const char *sym_hist_filter;

35 36
typedef int (*symbol_filter_t)(struct dso *self, struct symbol *sym);

37
struct dso *dso__new(const char *name, unsigned int sym_priv_size);
38 39
void dso__delete(struct dso *self);

40 41 42 43 44
static inline void *dso__sym_priv(struct dso *self, struct symbol *sym)
{
	return ((void *)sym) - self->sym_priv_size;
}

45
struct symbol *dso__find_symbol(struct dso *self, u64 ip);
46

47
int dso__load_kernel(struct dso *self, const char *vmlinux,
48 49
		     symbol_filter_t filter, int verbose, int modules);
int dso__load_modules(struct dso *self, symbol_filter_t filter, int verbose);
50
int dso__load(struct dso *self, symbol_filter_t filter, int verbose);
51 52

size_t dso__fprintf(struct dso *self, FILE *fp);
53
char dso__symtab_origin(const struct dso *self);
54 55 56

void symbol__init(void);
#endif /* _PERF_SYMBOL_ */