John Kacur | 8b40f52 | 2009-09-24 18:02:18 +0200 | [diff] [blame] | 1 | #ifndef __PERF_THREAD_H |
| 2 | #define __PERF_THREAD_H |
| 3 | |
Frederic Weisbecker | 6baa0a5 | 2009-08-14 12:21:53 +0200 | [diff] [blame] | 4 | #include <linux/rbtree.h> |
Frederic Weisbecker | 6baa0a5 | 2009-08-14 12:21:53 +0200 | [diff] [blame] | 5 | #include <unistd.h> |
| 6 | #include "symbol.h" |
| 7 | |
| 8 | struct thread { |
Ingo Molnar | b5fae12 | 2009-09-11 12:12:54 +0200 | [diff] [blame] | 9 | struct rb_node rb_node; |
Arnaldo Carvalho de Melo | 1b46cdd | 2009-09-28 14:48:46 -0300 | [diff] [blame^] | 10 | struct rb_root maps; |
Ingo Molnar | b5fae12 | 2009-09-11 12:12:54 +0200 | [diff] [blame] | 11 | pid_t pid; |
Ingo Molnar | 0ec04e1 | 2009-09-16 17:40:48 +0200 | [diff] [blame] | 12 | char shortname[3]; |
Ingo Molnar | b5fae12 | 2009-09-11 12:12:54 +0200 | [diff] [blame] | 13 | char *comm; |
Frederic Weisbecker | 6baa0a5 | 2009-08-14 12:21:53 +0200 | [diff] [blame] | 14 | }; |
| 15 | |
| 16 | int thread__set_comm(struct thread *self, const char *comm); |
| 17 | struct thread * |
| 18 | threads__findnew(pid_t pid, struct rb_root *threads, struct thread **last_match); |
Frederic Weisbecker | 5b447a6 | 2009-08-31 06:45:18 +0200 | [diff] [blame] | 19 | struct thread * |
| 20 | register_idle_thread(struct rb_root *threads, struct thread **last_match); |
Frederic Weisbecker | 6baa0a5 | 2009-08-14 12:21:53 +0200 | [diff] [blame] | 21 | void thread__insert_map(struct thread *self, struct map *map); |
| 22 | int thread__fork(struct thread *self, struct thread *parent); |
Frederic Weisbecker | 6baa0a5 | 2009-08-14 12:21:53 +0200 | [diff] [blame] | 23 | size_t threads__fprintf(FILE *fp, struct rb_root *threads); |
John Kacur | 8b40f52 | 2009-09-24 18:02:18 +0200 | [diff] [blame] | 24 | |
Arnaldo Carvalho de Melo | 1b46cdd | 2009-09-28 14:48:46 -0300 | [diff] [blame^] | 25 | void maps__insert(struct rb_root *maps, struct map *map); |
| 26 | struct map *maps__find(struct rb_root *maps, u64 ip); |
| 27 | |
| 28 | static inline struct map *thread__find_map(struct thread *self, u64 ip) |
| 29 | { |
| 30 | return self ? maps__find(&self->maps, ip) : NULL; |
| 31 | } |
| 32 | |
John Kacur | 8b40f52 | 2009-09-24 18:02:18 +0200 | [diff] [blame] | 33 | #endif /* __PERF_THREAD_H */ |