symbol.h 1.3 KB

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