thread.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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 machine;
  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. void thread__insert_map(struct thread *self, struct map *map);
  23. int thread__fork(struct thread *self, struct thread *parent);
  24. static inline struct map *thread__find_map(struct thread *self,
  25. enum map_type type, u64 addr)
  26. {
  27. return self ? map_groups__find(&self->mg, type, addr) : NULL;
  28. }
  29. void thread__find_addr_map(struct thread *thread, struct machine *machine,
  30. u8 cpumode, enum map_type type, u64 addr,
  31. struct addr_location *al);
  32. void thread__find_addr_location(struct thread *thread, struct machine *machine,
  33. u8 cpumode, enum map_type type, u64 addr,
  34. struct addr_location *al,
  35. symbol_filter_t filter);
  36. #endif /* __PERF_THREAD_H */