thread.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. union {
  8. struct rb_node rb_node;
  9. struct list_head node;
  10. };
  11. struct map_groups mg;
  12. pid_t pid;
  13. char shortname[3];
  14. bool comm_set;
  15. char *comm;
  16. int comm_len;
  17. };
  18. struct perf_session;
  19. void thread__delete(struct thread *self);
  20. int thread__set_comm(struct thread *self, const char *comm);
  21. int thread__comm_len(struct thread *self);
  22. struct thread *perf_session__findnew(struct perf_session *self, pid_t pid);
  23. void thread__insert_map(struct thread *self, struct map *map);
  24. int thread__fork(struct thread *self, struct thread *parent);
  25. size_t perf_session__fprintf(struct perf_session *self, FILE *fp);
  26. static inline struct map *thread__find_map(struct thread *self,
  27. enum map_type type, u64 addr)
  28. {
  29. return self ? map_groups__find(&self->mg, type, addr) : NULL;
  30. }
  31. void thread__find_addr_map(struct thread *self,
  32. struct perf_session *session, u8 cpumode,
  33. enum map_type type, pid_t pid, u64 addr,
  34. struct addr_location *al);
  35. void thread__find_addr_location(struct thread *self,
  36. struct perf_session *session, u8 cpumode,
  37. enum map_type type, pid_t pid, u64 addr,
  38. struct addr_location *al,
  39. symbol_filter_t filter);
  40. #endif /* __PERF_THREAD_H */