session.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. struct thread;
  8. struct symbol_conf;
  9. struct perf_session {
  10. struct perf_header header;
  11. unsigned long size;
  12. unsigned long mmap_window;
  13. struct map_groups kmaps;
  14. struct rb_root threads;
  15. struct thread *last_match;
  16. int fd;
  17. int cwdlen;
  18. char *cwd;
  19. bool use_modules;
  20. char filename[0];
  21. };
  22. typedef int (*event_op)(event_t *self, struct perf_session *session);
  23. struct perf_event_ops {
  24. event_op process_sample_event;
  25. event_op process_mmap_event;
  26. event_op process_comm_event;
  27. event_op process_fork_event;
  28. event_op process_exit_event;
  29. event_op process_lost_event;
  30. event_op process_read_event;
  31. event_op process_throttle_event;
  32. event_op process_unthrottle_event;
  33. int (*sample_type_check)(u64 sample_type);
  34. unsigned long total_unknown;
  35. bool full_paths;
  36. };
  37. struct perf_session *perf_session__new(const char *filename, int mode,
  38. bool force, struct symbol_conf *conf);
  39. void perf_session__delete(struct perf_session *self);
  40. int perf_session__process_events(struct perf_session *self,
  41. struct perf_event_ops *event_ops);
  42. int perf_header__read_build_ids(int input, u64 offset, u64 file_size);
  43. #endif /* __PERF_SESSION_H */