session.h 1.4 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 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. int fd;
  25. int cwdlen;
  26. char *cwd;
  27. char filename[0];
  28. };
  29. typedef int (*event_op)(event_t *self, struct perf_session *session);
  30. struct perf_event_ops {
  31. event_op sample,
  32. mmap,
  33. comm,
  34. fork,
  35. exit,
  36. lost,
  37. read,
  38. throttle,
  39. unthrottle;
  40. };
  41. struct perf_session *perf_session__new(const char *filename, int mode, bool force);
  42. void perf_session__delete(struct perf_session *self);
  43. int perf_session__process_events(struct perf_session *self,
  44. struct perf_event_ops *event_ops);
  45. struct symbol **perf_session__resolve_callchain(struct perf_session *self,
  46. struct thread *thread,
  47. struct ip_callchain *chain,
  48. struct symbol **parent);
  49. bool perf_session__has_traces(struct perf_session *self, const char *msg);
  50. int perf_header__read_build_ids(int input, u64 offset, u64 file_size);
  51. #endif /* __PERF_SESSION_H */