• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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;
12 
13 /*
14  * DSOs are put into both a list for fast iteration and rbtree for fast
15  * long name lookup.
16  */
17 struct dsos {
18 	struct list_head    head;
19 	struct rb_root	    root;	/* rbtree root sorted by long name */
20 	struct rw_semaphore lock;
21 };
22 
23 void __dsos__add(struct dsos *dsos, struct dso *dso);
24 void dsos__add(struct dsos *dsos, struct dso *dso);
25 struct dso *__dsos__addnew(struct dsos *dsos, const char *name);
26 struct dso *__dsos__find(struct dsos *dsos, const char *name, bool cmp_short);
27 struct dso *dsos__find(struct dsos *dsos, const char *name, bool cmp_short);
28 struct dso *__dsos__findnew(struct dsos *dsos, const char *name);
29 struct dso *dsos__findnew(struct dsos *dsos, const char *name);
30 
31 struct dso *__dsos__findnew_link_by_longname(struct rb_root *root, struct dso *dso, const char *name);
32 
__dsos__findnew_by_longname(struct rb_root * root,const char * name)33 static inline struct dso *__dsos__findnew_by_longname(struct rb_root *root, const char *name)
34 {
35 	return __dsos__findnew_link_by_longname(root, NULL, name);
36 }
37 
38 bool __dsos__read_build_ids(struct list_head *head, bool with_hits);
39 
40 size_t __dsos__fprintf_buildid(struct list_head *head, FILE *fp,
41 			       bool (skip)(struct dso *dso, int parm), int parm);
42 size_t __dsos__fprintf(struct list_head *head, FILE *fp);
43 
44 #endif /* __PERF_DSOS */
45