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

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

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

struct dso {
	struct list_head node;
	struct rb_root	 syms;
23
	struct symbol    *(*find_symbol)(struct dso *, u64 ip);
24 25
	unsigned int	 sym_priv_size;
	unsigned char	 prelinked;
26 27 28
	char		 name[0];
};

29 30
const char *sym_hist_filter;

31 32
typedef int (*symbol_filter_t)(struct dso *self, struct symbol *sym);

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

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

41
struct symbol *dso__find_symbol(struct dso *self, u64 ip);
42

43
int dso__load_kernel(struct dso *self, const char *vmlinux,
44 45
		     symbol_filter_t filter, int verbose);
int dso__load(struct dso *self, symbol_filter_t filter, int verbose);
46 47 48 49 50

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

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