hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/tools/perf/util/machine.h
....@@ -4,16 +4,18 @@
44
55 #include <sys/types.h>
66 #include <linux/rbtree.h>
7
-#include "map.h"
8
-#include "dso.h"
9
-#include "event.h"
7
+#include "maps.h"
8
+#include "dsos.h"
109 #include "rwsem.h"
1110
1211 struct addr_location;
1312 struct branch_stack;
14
-struct perf_evsel;
13
+struct dso;
14
+struct dso_id;
15
+struct evsel;
1516 struct perf_sample;
1617 struct symbol;
18
+struct target;
1719 struct thread;
1820 union perf_event;
1921
....@@ -29,11 +31,11 @@
2931 #define THREADS__TABLE_SIZE (1 << THREADS__TABLE_BITS)
3032
3133 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;
3739 };
3840
3941 struct machine {
....@@ -49,7 +51,7 @@
4951 struct vdso_info *vdso_info;
5052 struct perf_env *env;
5153 struct dsos dsos;
52
- struct map_groups kmaps;
54
+ struct maps kmaps;
5355 struct map *vmlinux_map;
5456 u64 kernel_start;
5557 pid_t *current_tid;
....@@ -81,7 +83,7 @@
8183 static inline
8284 struct maps *machine__kernel_maps(struct machine *machine)
8385 {
84
- return &machine->kmaps.maps;
86
+ return &machine->kmaps;
8587 }
8688
8789 int machine__get_kernel_start(struct machine *machine);
....@@ -126,10 +128,19 @@
126128 int machine__process_namespaces_event(struct machine *machine,
127129 union perf_event *event,
128130 struct perf_sample *sample);
131
+int machine__process_cgroup_event(struct machine *machine,
132
+ union perf_event *event,
133
+ struct perf_sample *sample);
129134 int machine__process_mmap_event(struct machine *machine, union perf_event *event,
130135 struct perf_sample *sample);
131136 int machine__process_mmap2_event(struct machine *machine, union perf_event *event,
132137 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);
133144 int machine__process_event(struct machine *machine, union perf_event *event,
134145 struct perf_sample *sample);
135146
....@@ -137,7 +148,7 @@
137148
138149 struct machines {
139150 struct machine host;
140
- struct rb_root guests;
151
+ struct rb_root_cached guests;
141152 };
142153
143154 void machines__init(struct machines *machines);
....@@ -172,7 +183,7 @@
172183
173184 int thread__resolve_callchain(struct thread *thread,
174185 struct callchain_cursor *cursor,
175
- struct perf_evsel *evsel,
186
+ struct evsel *evsel,
176187 struct perf_sample *sample,
177188 struct symbol **parent,
178189 struct addr_location *root_al,
....@@ -198,6 +209,7 @@
198209 struct thread *__machine__findnew_thread(struct machine *machine, pid_t pid, pid_t tid);
199210 struct thread *machine__findnew_thread(struct machine *machine, pid_t pid, pid_t tid);
200211
212
+struct dso *machine__findnew_dso_id(struct machine *machine, const char *filename, struct dso_id *id);
201213 struct dso *machine__findnew_dso(struct machine *machine, const char *filename);
202214
203215 size_t machine__fprintf(struct machine *machine, FILE *fp);
....@@ -206,7 +218,7 @@
206218 struct symbol *machine__find_kernel_symbol(struct machine *machine, u64 addr,
207219 struct map **mapp)
208220 {
209
- return map_groups__find_symbol(&machine->kmaps, addr, mapp);
221
+ return maps__find_symbol(&machine->kmaps, addr, mapp);
210222 }
211223
212224 static inline
....@@ -214,11 +226,9 @@
214226 const char *name,
215227 struct map **mapp)
216228 {
217
- return map_groups__find_symbol_by_name(&machine->kmaps, name, mapp);
229
+ return maps__find_symbol_by_name(&machine->kmaps, name, mapp);
218230 }
219231
220
-struct map *machine__findnew_module_map(struct machine *machine, u64 start,
221
- const char *filename);
222232 int arch__fix_module_text_start(u64 *start, u64 *size, const char *name);
223233
224234 int machine__load_kallsyms(struct machine *machine, const char *filename);
....@@ -240,29 +250,16 @@
240250
241251 size_t machine__fprintf_vmlinux_path(struct machine *machine, FILE *fp);
242252
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);
243257 int machine__for_each_thread(struct machine *machine,
244258 int (*fn)(struct thread *thread, void *p),
245259 void *priv);
246260 int machines__for_each_thread(struct machines *machines,
247261 int (*fn)(struct thread *thread, void *p),
248262 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
-}
266263
267264 pid_t machine__get_current_tid(struct machine *machine, int cpu);
268265 int machine__set_current_tid(struct machine *machine, int cpu, pid_t pid,