symbol.h 1.4 KB

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