symbol.h 1.1 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
#ifndef _PERF_SYMBOL_
#define _PERF_SYMBOL_ 1

#include <linux/types.h>
#include "list.h"
#include "rbtree.h"

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

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

27 28
const char *sym_hist_filter;

29 30
typedef int (*symbol_filter_t)(struct dso *self, struct symbol *sym);

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

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

39
struct symbol *dso__find_symbol(struct dso *self, __u64 ip);
40

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

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

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