symbol.h 1.3 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 30 31
	char		 name[0];
};

32 33
const char *sym_hist_filter;

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

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

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

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

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

size_t dso__fprintf(struct dso *self, FILE *fp);

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