xref: /linux-6.15/tools/perf/util/annotate-data.h (revision fc044c53)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _PERF_ANNOTATE_DATA_H
3 #define _PERF_ANNOTATE_DATA_H
4 
5 #include <errno.h>
6 #include <linux/compiler.h>
7 #include <linux/rbtree.h>
8 #include <linux/types.h>
9 
10 struct map_symbol;
11 
12 /**
13  * struct annotated_data_type - Data type to profile
14  * @type_name: Name of the data type
15  * @type_size: Size of the data type
16  *
17  * This represents a data type accessed by samples in the profile data.
18  */
19 struct annotated_data_type {
20 	struct rb_node node;
21 	char *type_name;
22 	int type_size;
23 };
24 
25 #ifdef HAVE_DWARF_SUPPORT
26 
27 /* Returns data type at the location (ip, reg, offset) */
28 struct annotated_data_type *find_data_type(struct map_symbol *ms, u64 ip,
29 					   int reg, int offset);
30 
31 /* Release all data type information in the tree */
32 void annotated_data_type__tree_delete(struct rb_root *root);
33 
34 #else /* HAVE_DWARF_SUPPORT */
35 
36 static inline struct annotated_data_type *
37 find_data_type(struct map_symbol *ms __maybe_unused, u64 ip __maybe_unused,
38 	       int reg __maybe_unused, int offset __maybe_unused)
39 {
40 	return NULL;
41 }
42 
43 static inline void annotated_data_type__tree_delete(struct rb_root *root __maybe_unused)
44 {
45 }
46 
47 #endif /* HAVE_DWARF_SUPPORT */
48 
49 #endif /* _PERF_ANNOTATE_DATA_H */
50