blob: 2c48ace8203bc8d1ae0b355a74b2a34577f5a1a8 [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>
Peter Zijlstra7c6a1c62009-06-25 17:05:54 +02005#include "types.h"
Arnaldo Carvalho de Meloa2928c42009-05-28 14:55:04 -03006#include "list.h"
7#include "rbtree.h"
8
9struct symbol {
10 struct rb_node rb_node;
Paul Mackerras9cffa8d2009-06-19 22:21:42 +100011 u64 start;
12 u64 end;
13 u64 obj_start;
14 u64 hist_sum;
15 u64 *hist;
Frederic Weisbecker301406b2009-06-13 00:11:21 +020016 void *priv;
Arnaldo Carvalho de Meloa2928c42009-05-28 14:55:04 -030017 char name[0];
18};
19
20struct dso {
21 struct list_head node;
22 struct rb_root syms;
Paul Mackerras9cffa8d2009-06-19 22:21:42 +100023 struct symbol *(*find_symbol)(struct dso *, u64 ip);
Arnaldo Carvalho de Melof5812a72009-06-30 11:43:17 -030024 unsigned int sym_priv_size;
25 unsigned char prelinked;
Arnaldo Carvalho de Meloa2928c42009-05-28 14:55:04 -030026 char name[0];
27};
28
Ingo Molnar0b73da32009-06-06 15:48:52 +020029const char *sym_hist_filter;
30
Arnaldo Carvalho de Melo69ee69f2009-05-28 14:55:26 -030031typedef int (*symbol_filter_t)(struct dso *self, struct symbol *sym);
32
Arnaldo Carvalho de Melo0085c9542009-05-28 14:55:13 -030033struct dso *dso__new(const char *name, unsigned int sym_priv_size);
Arnaldo Carvalho de Meloa2928c42009-05-28 14:55:04 -030034void dso__delete(struct dso *self);
35
Arnaldo Carvalho de Melo0085c9542009-05-28 14:55:13 -030036static inline void *dso__sym_priv(struct dso *self, struct symbol *sym)
37{
38 return ((void *)sym) - self->sym_priv_size;
39}
40
Paul Mackerras9cffa8d2009-06-19 22:21:42 +100041struct symbol *dso__find_symbol(struct dso *self, u64 ip);
Arnaldo Carvalho de Meloa2928c42009-05-28 14:55:04 -030042
Arnaldo Carvalho de Melo69ee69f2009-05-28 14:55:26 -030043int dso__load_kernel(struct dso *self, const char *vmlinux,
Ingo Molnarbd741372009-06-04 14:13:04 +020044 symbol_filter_t filter, int verbose);
45int dso__load(struct dso *self, symbol_filter_t filter, int verbose);
Arnaldo Carvalho de Meloa2928c42009-05-28 14:55:04 -030046
47size_t dso__fprintf(struct dso *self, FILE *fp);
48
49void symbol__init(void);
50#endif /* _PERF_SYMBOL_ */