session.h 1.6 KB

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