xref: /linux/tools/perf/util/tool.h (revision de6e0b198239857943db395377dc1d2ddd6c05df)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __PERF_TOOL_H
3 #define __PERF_TOOL_H
4 
5 #include <stdbool.h>
6 
7 #include <linux/types.h>
8 
9 struct perf_session;
10 union perf_event;
11 struct evlist;
12 struct evsel;
13 struct perf_sample;
14 struct perf_tool;
15 struct machine;
16 struct ordered_events;
17 
18 typedef int (*event_sample)(struct perf_tool *tool, union perf_event *event,
19 			    struct perf_sample *sample,
20 			    struct evsel *evsel, struct machine *machine);
21 
22 typedef int (*event_op)(struct perf_tool *tool, union perf_event *event,
23 			struct perf_sample *sample, struct machine *machine);
24 
25 typedef int (*event_attr_op)(struct perf_tool *tool,
26 			     union perf_event *event,
27 			     struct evlist **pevlist);
28 
29 typedef int (*event_op2)(struct perf_session *session, union perf_event *event);
30 typedef s64 (*event_op3)(struct perf_session *session, union perf_event *event);
31 typedef int (*event_op4)(struct perf_session *session, union perf_event *event, u64 data);
32 
33 typedef int (*event_oe)(struct perf_tool *tool, union perf_event *event,
34 			struct ordered_events *oe);
35 
36 enum show_feature_header {
37 	SHOW_FEAT_NO_HEADER = 0,
38 	SHOW_FEAT_HEADER,
39 	SHOW_FEAT_HEADER_FULL_INFO,
40 };
41 
42 struct perf_tool {
43 	event_sample	sample,
44 			read;
45 	event_op	mmap,
46 			mmap2,
47 			comm,
48 			namespaces,
49 			cgroup,
50 			fork,
51 			exit,
52 			lost,
53 			lost_samples,
54 			aux,
55 			itrace_start,
56 			context_switch,
57 			throttle,
58 			unthrottle,
59 			ksymbol,
60 			bpf,
61 			text_poke;
62 
63 	event_attr_op	attr;
64 	event_attr_op	event_update;
65 	event_op2	tracing_data;
66 	event_oe	finished_round;
67 	event_op2	build_id,
68 			id_index,
69 			auxtrace_info,
70 			auxtrace_error,
71 			time_conv,
72 			thread_map,
73 			cpu_map,
74 			stat_config,
75 			stat,
76 			stat_round,
77 			feature;
78 	event_op4	compressed;
79 	event_op3	auxtrace;
80 	bool		ordered_events;
81 	bool		ordering_requires_timestamps;
82 	bool		namespace_events;
83 	bool		cgroup_events;
84 	bool		no_warn;
85 	enum show_feature_header show_feat_hdr;
86 };
87 
88 #endif /* __PERF_TOOL_H */
89