projects/linux·blob master · refs

116 lines · 2.7 KiB

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
9struct perf_session;
10union perf_event;
11struct evlist;
12struct perf_sample;
13struct perf_tool;
14struct machine;
15struct ordered_events;
16
17typedef int (*event_sample)(const struct perf_tool *tool, union perf_event *event,
18 struct perf_sample *sample,
19 struct machine *machine);
20
21typedef int (*event_op)(const struct perf_tool *tool, union perf_event *event,
22 struct perf_sample *sample, struct machine *machine);
23
24typedef int (*event_attr_op)(const struct perf_tool *tool,
25 union perf_event *event,
26 struct evlist **pevlist);
27
28typedef int (*event_op2)(const struct perf_tool *tool, struct perf_session *session,
29 union perf_event *event);
30typedef s64 (*event_op3)(const struct perf_tool *tool, struct perf_session *session,
31 union perf_event *event);
32typedef int (*event_op4)(const struct perf_tool *tool, struct perf_session *session,
33 union perf_event *event, u64 data, const char *str);
34
35typedef int (*event_oe)(const struct perf_tool *tool, union perf_event *event,
36 struct ordered_events *oe);
37
38enum show_feature_header {
39 SHOW_FEAT_NO_HEADER = 0,
40 SHOW_FEAT_HEADER,
41 SHOW_FEAT_HEADER_FULL_INFO,
42};
43
44struct perf_tool {
45 event_sample sample,
46 read,
47 callchain_deferred;
48 event_op mmap,
49 mmap2,
50 comm,
51 namespaces,
52 cgroup,
53 fork,
54 exit,
55 lost,
56 lost_samples,
57 aux,
58 itrace_start,
59 aux_output_hw_id,
60 context_switch,
61 throttle,
62 unthrottle,
63 ksymbol,
64 bpf,
65 text_poke;
66
67 event_attr_op attr;
68 event_attr_op event_update;
69 event_op2 tracing_data;
70 event_oe finished_round;
71 event_op2 build_id,
72 id_index,
73 auxtrace_info,
74 auxtrace_error,
75 time_conv,
76 thread_map,
77 cpu_map,
78 stat_config,
79 stat,
80 stat_round,
81 feature,
82 finished_init,
83 bpf_metadata,
84 schedstat_cpu,
85 schedstat_domain;
86 event_op4 compressed;
87 event_op3 auxtrace;
88 bool ordered_events;
89 bool ordering_requires_timestamps;
90 bool namespace_events;
91 bool cgroup_events;
92 bool no_warn;
93 bool dont_split_sample_group;
94 bool merge_deferred_callchains;
95 enum show_feature_header show_feat_hdr;
96};
97
98void perf_tool__init(struct perf_tool *tool, bool ordered_events);
99
100bool perf_tool__compressed_is_stub(const struct perf_tool *tool);
101
102int process_event_sample_stub(const struct perf_tool *tool,
103 union perf_event *event,
104 struct perf_sample *sample,
105 struct machine *machine);
106
107struct delegate_tool {
108 /** @tool: The actual tool that calls the delegate. */
109 struct perf_tool tool;
110 /** @delegate: The tool that is delegated to. */
111 struct perf_tool *delegate;
112};
113
114void delegate_tool__init(struct delegate_tool *tool, struct perf_tool *delegate);
115
116#endif /* __PERF_TOOL_H */