thread.h 1.2 KB

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