thread.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #ifndef __PERF_THREAD_H
  2. #define __PERF_THREAD_H
  3. #include <linux/rbtree.h>
  4. #include <unistd.h>
  5. #include "symbol.h"
  6. struct thread {
  7. struct rb_node rb_node;
  8. struct map_groups mg;
  9. pid_t pid;
  10. char shortname[3];
  11. bool comm_set;
  12. char *comm;
  13. int comm_len;
  14. };
  15. struct perf_session;
  16. int find_all_tid(int pid, pid_t ** all_tid);
  17. int thread__set_comm(struct thread *self, const char *comm);
  18. int thread__comm_len(struct thread *self);
  19. struct thread *perf_session__findnew(struct perf_session *self, pid_t pid);
  20. void thread__insert_map(struct thread *self, struct map *map);
  21. int thread__fork(struct thread *self, struct thread *parent);
  22. size_t perf_session__fprintf(struct perf_session *self, FILE *fp);
  23. static inline struct map *thread__find_map(struct thread *self,
  24. enum map_type type, u64 addr)
  25. {
  26. return self ? map_groups__find(&self->mg, type, addr) : NULL;
  27. }
  28. void thread__find_addr_map(struct thread *self,
  29. struct perf_session *session, u8 cpumode,
  30. enum map_type type, pid_t pid, u64 addr,
  31. struct addr_location *al);
  32. void thread__find_addr_location(struct thread *self,
  33. struct perf_session *session, u8 cpumode,
  34. enum map_type type, pid_t pid, u64 addr,
  35. struct addr_location *al,
  36. symbol_filter_t filter);
  37. #endif /* __PERF_THREAD_H */