Commit | Line | Data |
---|---|---|
8b40f521 JK |
1 | #ifndef __PERF_THREAD_H |
2 | #define __PERF_THREAD_H | |
3 | ||
6baa0a5a | 4 | #include <linux/rbtree.h> |
6baa0a5a FW |
5 | #include <unistd.h> |
6 | #include "symbol.h" | |
7 | ||
9958e1f0 | 8 | struct map_groups { |
95011c60 ACM |
9 | struct rb_root maps[MAP__NR_TYPES]; |
10 | struct list_head removed_maps[MAP__NR_TYPES]; | |
9958e1f0 ACM |
11 | }; |
12 | ||
65f2ed2b ACM |
13 | size_t __map_groups__fprintf_maps(struct map_groups *self, |
14 | enum map_type type, FILE *fp); | |
15 | ||
9958e1f0 ACM |
16 | struct thread { |
17 | struct rb_node rb_node; | |
18 | struct map_groups mg; | |
19 | pid_t pid; | |
0ec04e16 | 20 | char shortname[3]; |
faa5c5c3 | 21 | bool comm_set; |
b5fae128 | 22 | char *comm; |
a4fb581b | 23 | int comm_len; |
6baa0a5a FW |
24 | }; |
25 | ||
d6d901c2 | 26 | int find_all_tid(int pid, pid_t ** all_tid); |
9958e1f0 | 27 | void map_groups__init(struct map_groups *self); |
6baa0a5a | 28 | int thread__set_comm(struct thread *self, const char *comm); |
a4fb581b | 29 | int thread__comm_len(struct thread *self); |
b3165f41 | 30 | struct thread *perf_session__findnew(struct perf_session *self, pid_t pid); |
6baa0a5a FW |
31 | void thread__insert_map(struct thread *self, struct map *map); |
32 | int thread__fork(struct thread *self, struct thread *parent); | |
9958e1f0 | 33 | size_t map_groups__fprintf_maps(struct map_groups *self, FILE *fp); |
b3165f41 | 34 | size_t perf_session__fprintf(struct perf_session *self, FILE *fp); |
8b40f521 | 35 | |
1b46cddf | 36 | void maps__insert(struct rb_root *maps, struct map *map); |
1ed091c4 | 37 | struct map *maps__find(struct rb_root *maps, u64 addr); |
439d473b | 38 | |
9958e1f0 ACM |
39 | static inline void map_groups__insert(struct map_groups *self, struct map *map) |
40 | { | |
41 | maps__insert(&self->maps[map->type], map); | |
42 | } | |
43 | ||
44 | static inline struct map *map_groups__find(struct map_groups *self, | |
1ed091c4 | 45 | enum map_type type, u64 addr) |
1b46cddf | 46 | { |
9958e1f0 | 47 | return maps__find(&self->maps[type], addr); |
1b46cddf ACM |
48 | } |
49 | ||
9958e1f0 ACM |
50 | static inline struct map *thread__find_map(struct thread *self, |
51 | enum map_type type, u64 addr) | |
95011c60 | 52 | { |
9958e1f0 | 53 | return self ? map_groups__find(&self->mg, type, addr) : NULL; |
95011c60 | 54 | } |
1ed091c4 | 55 | |
59ee68ec ACM |
56 | void thread__find_addr_map(struct thread *self, |
57 | struct perf_session *session, u8 cpumode, | |
58 | enum map_type type, u64 addr, | |
59 | struct addr_location *al); | |
60 | ||
4aa65636 ACM |
61 | void thread__find_addr_location(struct thread *self, |
62 | struct perf_session *session, u8 cpumode, | |
1ed091c4 ACM |
63 | enum map_type type, u64 addr, |
64 | struct addr_location *al, | |
65 | symbol_filter_t filter); | |
9958e1f0 ACM |
66 | struct symbol *map_groups__find_symbol(struct map_groups *self, |
67 | enum map_type type, u64 addr, | |
68 | symbol_filter_t filter); | |
1ed091c4 | 69 | |
9de89fe7 ACM |
70 | static inline struct symbol *map_groups__find_function(struct map_groups *self, |
71 | u64 addr, | |
72 | symbol_filter_t filter) | |
1ed091c4 | 73 | { |
9de89fe7 | 74 | return map_groups__find_symbol(self, MAP__FUNCTION, addr, filter); |
1ed091c4 | 75 | } |
79406cd7 ACM |
76 | |
77 | struct map *map_groups__find_by_name(struct map_groups *self, | |
78 | enum map_type type, const char *name); | |
b7cece76 ACM |
79 | |
80 | int __map_groups__create_kernel_maps(struct map_groups *self, | |
81 | struct map *vmlinux_maps[MAP__NR_TYPES], | |
82 | struct dso *kernel); | |
9de89fe7 ACM |
83 | int map_groups__create_kernel_maps(struct map_groups *self, |
84 | struct map *vmlinux_maps[MAP__NR_TYPES]); | |
85 | ||
86 | struct map *map_groups__new_module(struct map_groups *self, u64 start, | |
87 | const char *filename); | |
8b40f521 | 88 | #endif /* __PERF_THREAD_H */ |