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)(const 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)(const struct perf_tool *tool, union perf_event *event, 23 struct perf_sample *sample, struct machine *machine); 24 25 typedef int (*event_attr_op)(const struct perf_tool *tool, 26 union perf_event *event, 27 struct evlist **pevlist); 28 29 typedef int (*event_op2)(const struct perf_tool *tool, struct perf_session *session, 30 union perf_event *event); 31 typedef s64 (*event_op3)(const struct perf_tool *tool, struct perf_session *session, 32 union perf_event *event); 33 typedef int (*event_op4)(const struct perf_tool *tool, struct perf_session *session, 34 union perf_event *event, u64 data, const char *str); 35 36 typedef int (*event_oe)(const struct perf_tool *tool, union perf_event *event, 37 struct ordered_events *oe); 38 39 enum show_feature_header { 40 SHOW_FEAT_NO_HEADER = 0, 41 SHOW_FEAT_HEADER, 42 SHOW_FEAT_HEADER_FULL_INFO, 43 }; 44 45 struct perf_tool { 46 event_sample sample, 47 read; 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 event_op4 compressed; 85 event_op3 auxtrace; 86 bool ordered_events; 87 bool ordering_requires_timestamps; 88 bool namespace_events; 89 bool cgroup_events; 90 bool no_warn; 91 bool dont_split_sample_group; 92 enum show_feature_header show_feat_hdr; 93 }; 94 95 void perf_tool__init(struct perf_tool *tool, bool ordered_events); 96 97 bool perf_tool__compressed_is_stub(const struct perf_tool *tool); 98 99 int process_event_sample_stub(const struct perf_tool *tool, 100 union perf_event *event, 101 struct perf_sample *sample, 102 struct evsel *evsel, 103 struct machine *machine); 104 105 struct delegate_tool { 106 /** @tool: The actual tool that calls the delegate. */ 107 struct perf_tool tool; 108 /** @delegate: The tool that is delegated to. */ 109 struct perf_tool *delegate; 110 }; 111 112 void delegate_tool__init(struct delegate_tool *tool, struct perf_tool *delegate); 113 114 #endif /* __PERF_TOOL_H */ 115