blob: b0299bc0cf50e799b6bf95415c0087063259757b [file] [log] [blame]
Arnaldo Carvalho de Meloa2928c42009-05-28 14:55:04 -03001#ifndef _PERF_SYMBOL_
2#define _PERF_SYMBOL_ 1
3
4#include <linux/types.h>
5#include "list.h"
6#include "rbtree.h"
7
8struct symbol {
9 struct rb_node rb_node;
10 __u64 start;
11 __u64 end;
12 char name[0];
13};
14
15struct dso {
16 struct list_head node;
17 struct rb_root syms;
Arnaldo Carvalho de Melo0085c9542009-05-28 14:55:13 -030018 unsigned int sym_priv_size;
Arnaldo Carvalho de Meloa2928c42009-05-28 14:55:04 -030019 char name[0];
20};
21
Arnaldo Carvalho de Melo69ee69f2009-05-28 14:55:26 -030022typedef int (*symbol_filter_t)(struct dso *self, struct symbol *sym);
23
Arnaldo Carvalho de Melo0085c9542009-05-28 14:55:13 -030024struct dso *dso__new(const char *name, unsigned int sym_priv_size);
Arnaldo Carvalho de Meloa2928c42009-05-28 14:55:04 -030025void dso__delete(struct dso *self);
26
Arnaldo Carvalho de Melo0085c9542009-05-28 14:55:13 -030027static inline void *dso__sym_priv(struct dso *self, struct symbol *sym)
28{
29 return ((void *)sym) - self->sym_priv_size;
30}
31
Arnaldo Carvalho de Meloa2928c42009-05-28 14:55:04 -030032struct symbol *dso__find_symbol(struct dso *self, uint64_t ip);
33
Arnaldo Carvalho de Melo69ee69f2009-05-28 14:55:26 -030034int dso__load_kernel(struct dso *self, const char *vmlinux,
35 symbol_filter_t filter);
36int dso__load(struct dso *self, symbol_filter_t filter);
Arnaldo Carvalho de Meloa2928c42009-05-28 14:55:04 -030037
38size_t dso__fprintf(struct dso *self, FILE *fp);
39
40void symbol__init(void);
41#endif /* _PERF_SYMBOL_ */