symbol.h 1.1 KB

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