session.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #ifndef __PERF_SESSION_H
  2. #define __PERF_SESSION_H
  3. #include "event.h"
  4. #include "header.h"
  5. #include "thread.h"
  6. #include <linux/rbtree.h>
  7. #include "../../../include/linux/perf_event.h"
  8. struct ip_callchain;
  9. struct thread;
  10. struct symbol;
  11. struct perf_session {
  12. struct perf_header header;
  13. unsigned long size;
  14. unsigned long mmap_window;
  15. struct map_groups kmaps;
  16. struct rb_root threads;
  17. struct thread *last_match;
  18. struct map *vmlinux_maps[MAP__NR_TYPES];
  19. struct events_stats events_stats;
  20. unsigned long event_total[PERF_RECORD_MAX];
  21. unsigned long unknown_events;
  22. struct rb_root hists;
  23. u64 sample_type;
  24. struct {
  25. const char *name;
  26. u64 addr;
  27. } ref_reloc_sym;
  28. int fd;
  29. int cwdlen;
  30. char *cwd;
  31. char filename[0];
  32. };
  33. typedef int (*event_op)(event_t *self, struct perf_session *session);
  34. struct perf_event_ops {
  35. event_op sample,
  36. mmap,
  37. comm,
  38. fork,
  39. exit,
  40. lost,
  41. read,
  42. throttle,
  43. unthrottle;
  44. };
  45. struct perf_session *perf_session__new(const char *filename, int mode, bool force);
  46. void perf_session__delete(struct perf_session *self);
  47. void perf_event_header__bswap(struct perf_event_header *self);
  48. int perf_session__process_events(struct perf_session *self,
  49. struct perf_event_ops *event_ops);
  50. struct symbol **perf_session__resolve_callchain(struct perf_session *self,
  51. struct thread *thread,
  52. struct ip_callchain *chain,
  53. struct symbol **parent);
  54. bool perf_session__has_traces(struct perf_session *self, const char *msg);
  55. int perf_header__read_build_ids(struct perf_header *self, int input,
  56. u64 offset, u64 file_size);
  57. int perf_session__set_kallsyms_ref_reloc_sym(struct perf_session *self,
  58. const char *symbol_name,
  59. u64 addr);
  60. void perf_session__reloc_vmlinux_maps(struct perf_session *self,
  61. u64 unrelocated_addr);
  62. void mem_bswap_64(void *src, int byte_size);
  63. #endif /* __PERF_SESSION_H */