symbol.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #ifndef _PERF_SYMBOL_
  2. #define _PERF_SYMBOL_ 1
  3. #include <linux/types.h>
  4. #include "list.h"
  5. #include "rbtree.h"
  6. struct symbol {
  7. struct rb_node rb_node;
  8. __u64 start;
  9. __u64 end;
  10. __u64 obj_start;
  11. __u64 hist_sum;
  12. __u64 *hist;
  13. char name[0];
  14. };
  15. struct dso {
  16. struct list_head node;
  17. struct rb_root syms;
  18. unsigned int sym_priv_size;
  19. struct symbol *(*find_symbol)(struct dso *, __u64 ip);
  20. char name[0];
  21. };
  22. const char *sym_hist_filter;
  23. typedef int (*symbol_filter_t)(struct dso *self, struct symbol *sym);
  24. struct dso *dso__new(const char *name, unsigned int sym_priv_size);
  25. void dso__delete(struct dso *self);
  26. static inline void *dso__sym_priv(struct dso *self, struct symbol *sym)
  27. {
  28. return ((void *)sym) - self->sym_priv_size;
  29. }
  30. struct symbol *dso__find_symbol(struct dso *self, __u64 ip);
  31. int dso__load_kernel(struct dso *self, const char *vmlinux,
  32. symbol_filter_t filter, int verbose);
  33. int dso__load(struct dso *self, symbol_filter_t filter, int verbose);
  34. size_t dso__fprintf(struct dso *self, FILE *fp);
  35. void symbol__init(void);
  36. #endif /* _PERF_SYMBOL_ */