Commit | Line | Data |
---|---|---|
4a3cec84 ACM |
1 | /* SPDX-License-Identifier: GPL-2.0 */ |
2 | #ifndef __PERF_DSOS | |
3 | #define __PERF_DSOS | |
4 | ||
5 | #include <stdbool.h> | |
6 | #include <stdio.h> | |
7 | #include <linux/list.h> | |
8 | #include <linux/rbtree.h> | |
9 | #include "rwsem.h" | |
10 | ||
11 | struct dso; | |
0e3149f8 | 12 | struct dso_id; |
f649ed80 IR |
13 | struct kmod_path; |
14 | struct machine; | |
4a3cec84 ACM |
15 | |
16 | /* | |
3f4ac23a IR |
17 | * Collection of DSOs as an array for iteration speed, but sorted for O(n) |
18 | * lookup. | |
4a3cec84 ACM |
19 | */ |
20 | struct dsos { | |
4a3cec84 | 21 | struct rw_semaphore lock; |
3f4ac23a IR |
22 | struct dso **dsos; |
23 | unsigned int cnt; | |
24 | unsigned int allocated; | |
25 | bool sorted; | |
4a3cec84 ACM |
26 | }; |
27 | ||
83acca9f IR |
28 | void dsos__init(struct dsos *dsos); |
29 | void dsos__exit(struct dsos *dsos); | |
30 | ||
3f4ac23a IR |
31 | int __dsos__add(struct dsos *dsos, struct dso *dso); |
32 | int dsos__add(struct dsos *dsos, struct dso *dso); | |
f649ed80 | 33 | struct dso *dsos__find(struct dsos *dsos, const char *name, bool cmp_short); |
4a3cec84 | 34 | |
0e3149f8 ACM |
35 | struct dso *dsos__findnew_id(struct dsos *dsos, const char *name, struct dso_id *id); |
36 | ||
0ffc8fca | 37 | bool dsos__read_build_ids(struct dsos *dsos, bool with_hits); |
83acca9f | 38 | |
0ffc8fca | 39 | size_t dsos__fprintf_buildid(struct dsos *dsos, FILE *fp, |
4a3cec84 | 40 | bool (skip)(struct dso *dso, int parm), int parm); |
0ffc8fca | 41 | size_t dsos__fprintf(struct dsos *dsos, FILE *fp); |
83acca9f | 42 | |
0ffc8fca | 43 | int dsos__hit_all(struct dsos *dsos); |
4a3cec84 | 44 | |
f649ed80 IR |
45 | struct dso *dsos__findnew_module_dso(struct dsos *dsos, struct machine *machine, |
46 | struct kmod_path *m, const char *filename); | |
47 | ||
48 | struct dso *dsos__find_kernel_dso(struct dsos *dsos); | |
49 | ||
73f3fea2 IR |
50 | int dsos__for_each_dso(struct dsos *dsos, int (*cb)(struct dso *dso, void *data), void *data); |
51 | ||
4a3cec84 | 52 | #endif /* __PERF_DSOS */ |