| .. | .. |
|---|
| 4 | 4 | |
|---|
| 5 | 5 | #include <sys/types.h> |
|---|
| 6 | 6 | #include <linux/rbtree.h> |
|---|
| 7 | | -#include "map.h" |
|---|
| 8 | | -#include "dso.h" |
|---|
| 9 | | -#include "event.h" |
|---|
| 7 | +#include "maps.h" |
|---|
| 8 | +#include "dsos.h" |
|---|
| 10 | 9 | #include "rwsem.h" |
|---|
| 11 | 10 | |
|---|
| 12 | 11 | struct addr_location; |
|---|
| 13 | 12 | struct branch_stack; |
|---|
| 14 | | -struct perf_evsel; |
|---|
| 13 | +struct dso; |
|---|
| 14 | +struct dso_id; |
|---|
| 15 | +struct evsel; |
|---|
| 15 | 16 | struct perf_sample; |
|---|
| 16 | 17 | struct symbol; |
|---|
| 18 | +struct target; |
|---|
| 17 | 19 | struct thread; |
|---|
| 18 | 20 | union perf_event; |
|---|
| 19 | 21 | |
|---|
| .. | .. |
|---|
| 29 | 31 | #define THREADS__TABLE_SIZE (1 << THREADS__TABLE_BITS) |
|---|
| 30 | 32 | |
|---|
| 31 | 33 | struct threads { |
|---|
| 32 | | - struct rb_root entries; |
|---|
| 33 | | - struct rw_semaphore lock; |
|---|
| 34 | | - unsigned int nr; |
|---|
| 35 | | - struct list_head dead; |
|---|
| 36 | | - struct thread *last_match; |
|---|
| 34 | + struct rb_root_cached entries; |
|---|
| 35 | + struct rw_semaphore lock; |
|---|
| 36 | + unsigned int nr; |
|---|
| 37 | + struct list_head dead; |
|---|
| 38 | + struct thread *last_match; |
|---|
| 37 | 39 | }; |
|---|
| 38 | 40 | |
|---|
| 39 | 41 | struct machine { |
|---|
| .. | .. |
|---|
| 49 | 51 | struct vdso_info *vdso_info; |
|---|
| 50 | 52 | struct perf_env *env; |
|---|
| 51 | 53 | struct dsos dsos; |
|---|
| 52 | | - struct map_groups kmaps; |
|---|
| 54 | + struct maps kmaps; |
|---|
| 53 | 55 | struct map *vmlinux_map; |
|---|
| 54 | 56 | u64 kernel_start; |
|---|
| 55 | 57 | pid_t *current_tid; |
|---|
| .. | .. |
|---|
| 81 | 83 | static inline |
|---|
| 82 | 84 | struct maps *machine__kernel_maps(struct machine *machine) |
|---|
| 83 | 85 | { |
|---|
| 84 | | - return &machine->kmaps.maps; |
|---|
| 86 | + return &machine->kmaps; |
|---|
| 85 | 87 | } |
|---|
| 86 | 88 | |
|---|
| 87 | 89 | int machine__get_kernel_start(struct machine *machine); |
|---|
| .. | .. |
|---|
| 126 | 128 | int machine__process_namespaces_event(struct machine *machine, |
|---|
| 127 | 129 | union perf_event *event, |
|---|
| 128 | 130 | struct perf_sample *sample); |
|---|
| 131 | +int machine__process_cgroup_event(struct machine *machine, |
|---|
| 132 | + union perf_event *event, |
|---|
| 133 | + struct perf_sample *sample); |
|---|
| 129 | 134 | int machine__process_mmap_event(struct machine *machine, union perf_event *event, |
|---|
| 130 | 135 | struct perf_sample *sample); |
|---|
| 131 | 136 | int machine__process_mmap2_event(struct machine *machine, union perf_event *event, |
|---|
| 132 | 137 | struct perf_sample *sample); |
|---|
| 138 | +int machine__process_ksymbol(struct machine *machine, |
|---|
| 139 | + union perf_event *event, |
|---|
| 140 | + struct perf_sample *sample); |
|---|
| 141 | +int machine__process_text_poke(struct machine *machine, |
|---|
| 142 | + union perf_event *event, |
|---|
| 143 | + struct perf_sample *sample); |
|---|
| 133 | 144 | int machine__process_event(struct machine *machine, union perf_event *event, |
|---|
| 134 | 145 | struct perf_sample *sample); |
|---|
| 135 | 146 | |
|---|
| .. | .. |
|---|
| 137 | 148 | |
|---|
| 138 | 149 | struct machines { |
|---|
| 139 | 150 | struct machine host; |
|---|
| 140 | | - struct rb_root guests; |
|---|
| 151 | + struct rb_root_cached guests; |
|---|
| 141 | 152 | }; |
|---|
| 142 | 153 | |
|---|
| 143 | 154 | void machines__init(struct machines *machines); |
|---|
| .. | .. |
|---|
| 172 | 183 | |
|---|
| 173 | 184 | int thread__resolve_callchain(struct thread *thread, |
|---|
| 174 | 185 | struct callchain_cursor *cursor, |
|---|
| 175 | | - struct perf_evsel *evsel, |
|---|
| 186 | + struct evsel *evsel, |
|---|
| 176 | 187 | struct perf_sample *sample, |
|---|
| 177 | 188 | struct symbol **parent, |
|---|
| 178 | 189 | struct addr_location *root_al, |
|---|
| .. | .. |
|---|
| 198 | 209 | struct thread *__machine__findnew_thread(struct machine *machine, pid_t pid, pid_t tid); |
|---|
| 199 | 210 | struct thread *machine__findnew_thread(struct machine *machine, pid_t pid, pid_t tid); |
|---|
| 200 | 211 | |
|---|
| 212 | +struct dso *machine__findnew_dso_id(struct machine *machine, const char *filename, struct dso_id *id); |
|---|
| 201 | 213 | struct dso *machine__findnew_dso(struct machine *machine, const char *filename); |
|---|
| 202 | 214 | |
|---|
| 203 | 215 | size_t machine__fprintf(struct machine *machine, FILE *fp); |
|---|
| .. | .. |
|---|
| 206 | 218 | struct symbol *machine__find_kernel_symbol(struct machine *machine, u64 addr, |
|---|
| 207 | 219 | struct map **mapp) |
|---|
| 208 | 220 | { |
|---|
| 209 | | - return map_groups__find_symbol(&machine->kmaps, addr, mapp); |
|---|
| 221 | + return maps__find_symbol(&machine->kmaps, addr, mapp); |
|---|
| 210 | 222 | } |
|---|
| 211 | 223 | |
|---|
| 212 | 224 | static inline |
|---|
| .. | .. |
|---|
| 214 | 226 | const char *name, |
|---|
| 215 | 227 | struct map **mapp) |
|---|
| 216 | 228 | { |
|---|
| 217 | | - return map_groups__find_symbol_by_name(&machine->kmaps, name, mapp); |
|---|
| 229 | + return maps__find_symbol_by_name(&machine->kmaps, name, mapp); |
|---|
| 218 | 230 | } |
|---|
| 219 | 231 | |
|---|
| 220 | | -struct map *machine__findnew_module_map(struct machine *machine, u64 start, |
|---|
| 221 | | - const char *filename); |
|---|
| 222 | 232 | int arch__fix_module_text_start(u64 *start, u64 *size, const char *name); |
|---|
| 223 | 233 | |
|---|
| 224 | 234 | int machine__load_kallsyms(struct machine *machine, const char *filename); |
|---|
| .. | .. |
|---|
| 240 | 250 | |
|---|
| 241 | 251 | size_t machine__fprintf_vmlinux_path(struct machine *machine, FILE *fp); |
|---|
| 242 | 252 | |
|---|
| 253 | +typedef int (*machine__dso_t)(struct dso *dso, struct machine *machine, void *priv); |
|---|
| 254 | + |
|---|
| 255 | +int machine__for_each_dso(struct machine *machine, machine__dso_t fn, |
|---|
| 256 | + void *priv); |
|---|
| 243 | 257 | int machine__for_each_thread(struct machine *machine, |
|---|
| 244 | 258 | int (*fn)(struct thread *thread, void *p), |
|---|
| 245 | 259 | void *priv); |
|---|
| 246 | 260 | int machines__for_each_thread(struct machines *machines, |
|---|
| 247 | 261 | int (*fn)(struct thread *thread, void *p), |
|---|
| 248 | 262 | void *priv); |
|---|
| 249 | | - |
|---|
| 250 | | -int __machine__synthesize_threads(struct machine *machine, struct perf_tool *tool, |
|---|
| 251 | | - struct target *target, struct thread_map *threads, |
|---|
| 252 | | - perf_event__handler_t process, bool data_mmap, |
|---|
| 253 | | - unsigned int proc_map_timeout, |
|---|
| 254 | | - unsigned int nr_threads_synthesize); |
|---|
| 255 | | -static inline |
|---|
| 256 | | -int machine__synthesize_threads(struct machine *machine, struct target *target, |
|---|
| 257 | | - struct thread_map *threads, bool data_mmap, |
|---|
| 258 | | - unsigned int proc_map_timeout, |
|---|
| 259 | | - unsigned int nr_threads_synthesize) |
|---|
| 260 | | -{ |
|---|
| 261 | | - return __machine__synthesize_threads(machine, NULL, target, threads, |
|---|
| 262 | | - perf_event__process, data_mmap, |
|---|
| 263 | | - proc_map_timeout, |
|---|
| 264 | | - nr_threads_synthesize); |
|---|
| 265 | | -} |
|---|
| 266 | 263 | |
|---|
| 267 | 264 | pid_t machine__get_current_tid(struct machine *machine, int cpu); |
|---|
| 268 | 265 | int machine__set_current_tid(struct machine *machine, int cpu, pid_t pid, |
|---|