session.h 1.7 KB

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