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