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