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 27
	unsigned int	 sym_priv_size;
	unsigned char	 prelinked;
28 29 30
	char		 name[0];
};

31 32
const char *sym_hist_filter;

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

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

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

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

45
int dso__load_kernel(struct dso *self, const char *vmlinux,
46 47
		     symbol_filter_t filter, int verbose, int modules);
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 51 52 53

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

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