.. | .. |
---|
5 | 5 | #include <linux/stddef.h> |
---|
6 | 6 | #include <linux/perf_event.h> |
---|
7 | 7 | #include <sys/types.h> |
---|
| 8 | +#include <stdio.h> // FILE |
---|
8 | 9 | #include <stdbool.h> |
---|
9 | 10 | #include <linux/bitmap.h> |
---|
10 | 11 | #include <linux/types.h> |
---|
11 | | -#include "event.h" |
---|
12 | 12 | #include "env.h" |
---|
13 | 13 | #include "pmu.h" |
---|
14 | 14 | |
---|
.. | .. |
---|
38 | 38 | HEADER_CACHE, |
---|
39 | 39 | HEADER_SAMPLE_TIME, |
---|
40 | 40 | HEADER_MEM_TOPOLOGY, |
---|
| 41 | + HEADER_CLOCKID, |
---|
| 42 | + HEADER_DIR_FORMAT, |
---|
| 43 | + HEADER_BPF_PROG_INFO, |
---|
| 44 | + HEADER_BPF_BTF, |
---|
| 45 | + HEADER_COMPRESSED, |
---|
| 46 | + HEADER_CPU_PMU_CAPS, |
---|
| 47 | + HEADER_CLOCK_DATA, |
---|
41 | 48 | HEADER_LAST_FEATURE, |
---|
42 | 49 | HEADER_FEAT_BITS = 256, |
---|
43 | 50 | }; |
---|
.. | .. |
---|
83 | 90 | struct perf_env env; |
---|
84 | 91 | }; |
---|
85 | 92 | |
---|
86 | | -struct perf_evlist; |
---|
| 93 | +struct feat_fd { |
---|
| 94 | + struct perf_header *ph; |
---|
| 95 | + int fd; |
---|
| 96 | + void *buf; /* Either buf != NULL or fd >= 0 */ |
---|
| 97 | + ssize_t offset; |
---|
| 98 | + size_t size; |
---|
| 99 | + struct evsel *events; |
---|
| 100 | +}; |
---|
| 101 | + |
---|
| 102 | +struct perf_header_feature_ops { |
---|
| 103 | + int (*write)(struct feat_fd *ff, struct evlist *evlist); |
---|
| 104 | + void (*print)(struct feat_fd *ff, FILE *fp); |
---|
| 105 | + int (*process)(struct feat_fd *ff, void *data); |
---|
| 106 | + const char *name; |
---|
| 107 | + bool full_only; |
---|
| 108 | + bool synthesize; |
---|
| 109 | +}; |
---|
| 110 | + |
---|
| 111 | +struct evlist; |
---|
87 | 112 | struct perf_session; |
---|
| 113 | +struct perf_tool; |
---|
| 114 | +union perf_event; |
---|
88 | 115 | |
---|
89 | 116 | int perf_session__read_header(struct perf_session *session); |
---|
90 | 117 | int perf_session__write_header(struct perf_session *session, |
---|
91 | | - struct perf_evlist *evlist, |
---|
| 118 | + struct evlist *evlist, |
---|
92 | 119 | int fd, bool at_exit); |
---|
93 | 120 | int perf_header__write_pipe(int fd); |
---|
94 | 121 | |
---|
.. | .. |
---|
106 | 133 | |
---|
107 | 134 | int perf_header__fprintf_info(struct perf_session *s, FILE *fp, bool full); |
---|
108 | 135 | |
---|
109 | | -int perf_event__synthesize_features(struct perf_tool *tool, |
---|
110 | | - struct perf_session *session, |
---|
111 | | - struct perf_evlist *evlist, |
---|
112 | | - perf_event__handler_t process); |
---|
113 | | - |
---|
114 | | -int perf_event__synthesize_extra_attr(struct perf_tool *tool, |
---|
115 | | - struct perf_evlist *evsel_list, |
---|
116 | | - perf_event__handler_t process, |
---|
117 | | - bool is_pipe); |
---|
118 | | - |
---|
119 | | -int perf_event__process_feature(struct perf_tool *tool, |
---|
120 | | - union perf_event *event, |
---|
121 | | - struct perf_session *session); |
---|
122 | | - |
---|
123 | | -int perf_event__synthesize_attr(struct perf_tool *tool, |
---|
124 | | - struct perf_event_attr *attr, u32 ids, u64 *id, |
---|
125 | | - perf_event__handler_t process); |
---|
126 | | -int perf_event__synthesize_attrs(struct perf_tool *tool, |
---|
127 | | - struct perf_session *session, |
---|
128 | | - perf_event__handler_t process); |
---|
129 | | -int perf_event__synthesize_event_update_unit(struct perf_tool *tool, |
---|
130 | | - struct perf_evsel *evsel, |
---|
131 | | - perf_event__handler_t process); |
---|
132 | | -int perf_event__synthesize_event_update_scale(struct perf_tool *tool, |
---|
133 | | - struct perf_evsel *evsel, |
---|
134 | | - perf_event__handler_t process); |
---|
135 | | -int perf_event__synthesize_event_update_name(struct perf_tool *tool, |
---|
136 | | - struct perf_evsel *evsel, |
---|
137 | | - perf_event__handler_t process); |
---|
138 | | -int perf_event__synthesize_event_update_cpus(struct perf_tool *tool, |
---|
139 | | - struct perf_evsel *evsel, |
---|
140 | | - perf_event__handler_t process); |
---|
| 136 | +int perf_event__process_feature(struct perf_session *session, |
---|
| 137 | + union perf_event *event); |
---|
141 | 138 | int perf_event__process_attr(struct perf_tool *tool, union perf_event *event, |
---|
142 | | - struct perf_evlist **pevlist); |
---|
| 139 | + struct evlist **pevlist); |
---|
143 | 140 | int perf_event__process_event_update(struct perf_tool *tool, |
---|
144 | 141 | union perf_event *event, |
---|
145 | | - struct perf_evlist **pevlist); |
---|
| 142 | + struct evlist **pevlist); |
---|
146 | 143 | size_t perf_event__fprintf_event_update(union perf_event *event, FILE *fp); |
---|
147 | | - |
---|
148 | | -int perf_event__synthesize_tracing_data(struct perf_tool *tool, |
---|
149 | | - int fd, struct perf_evlist *evlist, |
---|
150 | | - perf_event__handler_t process); |
---|
151 | | -int perf_event__process_tracing_data(struct perf_tool *tool, |
---|
152 | | - union perf_event *event, |
---|
153 | | - struct perf_session *session); |
---|
154 | | - |
---|
155 | | -int perf_event__synthesize_build_id(struct perf_tool *tool, |
---|
156 | | - struct dso *pos, u16 misc, |
---|
157 | | - perf_event__handler_t process, |
---|
158 | | - struct machine *machine); |
---|
159 | | -int perf_event__process_build_id(struct perf_tool *tool, |
---|
160 | | - union perf_event *event, |
---|
161 | | - struct perf_session *session); |
---|
| 144 | +int perf_event__process_tracing_data(struct perf_session *session, |
---|
| 145 | + union perf_event *event); |
---|
| 146 | +int perf_event__process_build_id(struct perf_session *session, |
---|
| 147 | + union perf_event *event); |
---|
162 | 148 | bool is_perf_magic(u64 magic); |
---|
163 | 149 | |
---|
164 | 150 | #define NAME_ALIGN 64 |
---|