symbol.h 1.3 KB

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