session.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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 events_stats events_stats;
  19. unsigned long event_total[PERF_RECORD_MAX];
  20. struct rb_root hists;
  21. u64 sample_type;
  22. int fd;
  23. int cwdlen;
  24. char *cwd;
  25. char filename[0];
  26. };
  27. typedef int (*event_op)(event_t *self, struct perf_session *session);
  28. struct perf_event_ops {
  29. event_op process_sample_event;
  30. event_op process_mmap_event;
  31. event_op process_comm_event;
  32. event_op process_fork_event;
  33. event_op process_exit_event;
  34. event_op process_lost_event;
  35. event_op process_read_event;
  36. event_op process_throttle_event;
  37. event_op process_unthrottle_event;
  38. int (*sample_type_check)(struct perf_session *session);
  39. unsigned long total_unknown;
  40. bool full_paths;
  41. };
  42. struct perf_session *perf_session__new(const char *filename, int mode, bool force);
  43. void perf_session__delete(struct perf_session *self);
  44. int perf_session__process_events(struct perf_session *self,
  45. struct perf_event_ops *event_ops);
  46. struct symbol **perf_session__resolve_callchain(struct perf_session *self,
  47. struct thread *thread,
  48. struct ip_callchain *chain,
  49. struct symbol **parent);
  50. int perf_header__read_build_ids(int input, u64 offset, u64 file_size);
  51. #endif /* __PERF_SESSION_H */