symbol.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. unsigned int sym_priv_size;
  21. struct symbol *(*find_symbol)(struct dso *, u64 ip);
  22. char name[0];
  23. };
  24. const char *sym_hist_filter;
  25. typedef int (*symbol_filter_t)(struct dso *self, struct symbol *sym);
  26. struct dso *dso__new(const char *name, unsigned int sym_priv_size);
  27. void dso__delete(struct dso *self);
  28. static inline void *dso__sym_priv(struct dso *self, struct symbol *sym)
  29. {
  30. return ((void *)sym) - self->sym_priv_size;
  31. }
  32. struct symbol *dso__find_symbol(struct dso *self, u64 ip);
  33. int dso__load_kernel(struct dso *self, const char *vmlinux,
  34. symbol_filter_t filter, int verbose);
  35. int dso__load(struct dso *self, symbol_filter_t filter, int verbose);
  36. size_t dso__fprintf(struct dso *self, FILE *fp);
  37. void symbol__init(void);
  38. #endif /* _PERF_SYMBOL_ */