Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / tools / perf / util / dsos.h
bloba26774950866e96ff77f0df836639ffc016240a6
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __PERF_DSOS
3 #define __PERF_DSOS
5 #include <stdbool.h>
6 #include <stdio.h>
7 #include <linux/list.h>
8 #include <linux/rbtree.h>
9 #include "rwsem.h"
11 struct dso;
12 struct dso_id;
13 struct kmod_path;
14 struct machine;
17 * Collection of DSOs as an array for iteration speed, but sorted for O(n)
18 * lookup.
20 struct dsos {
21 struct rw_semaphore lock;
22 struct dso **dsos;
23 unsigned int cnt;
24 unsigned int allocated;
25 bool sorted;
28 void dsos__init(struct dsos *dsos);
29 void dsos__exit(struct dsos *dsos);
31 int __dsos__add(struct dsos *dsos, struct dso *dso);
32 int dsos__add(struct dsos *dsos, struct dso *dso);
33 struct dso *dsos__find(struct dsos *dsos, const char *name, bool cmp_short);
35 struct dso *dsos__findnew_id(struct dsos *dsos, const char *name, const struct dso_id *id);
37 bool dsos__read_build_ids(struct dsos *dsos, bool with_hits);
39 size_t dsos__fprintf_buildid(struct dsos *dsos, FILE *fp,
40 bool (skip)(struct dso *dso, int parm), int parm);
41 size_t dsos__fprintf(struct dsos *dsos, FILE *fp);
43 int dsos__hit_all(struct dsos *dsos);
45 struct dso *dsos__findnew_module_dso(struct dsos *dsos, struct machine *machine,
46 struct kmod_path *m, const char *filename);
48 struct dso *dsos__find_kernel_dso(struct dsos *dsos);
50 int dsos__for_each_dso(struct dsos *dsos, int (*cb)(struct dso *dso, void *data), void *data);
52 #endif /* __PERF_DSOS */