1 #ifndef __PERF_RECORD_H
2 #define __PERF_RECORD_H
12 struct perf_event_header header;
17 char filename[PATH_MAX];
21 struct perf_event_header header;
30 char filename[PATH_MAX];
34 struct perf_event_header header;
40 struct perf_event_header header;
47 struct perf_event_header header;
53 * PERF_FORMAT_ENABLED | PERF_FORMAT_RUNNING | PERF_FORMAT_ID
56 struct perf_event_header header;
64 struct throttle_event {
65 struct perf_event_header header;
71 #define PERF_SAMPLE_MASK \
72 (PERF_SAMPLE_IP | PERF_SAMPLE_TID | \
73 PERF_SAMPLE_TIME | PERF_SAMPLE_ADDR | \
74 PERF_SAMPLE_ID | PERF_SAMPLE_STREAM_ID | \
75 PERF_SAMPLE_CPU | PERF_SAMPLE_PERIOD | \
76 PERF_SAMPLE_IDENTIFIER)
78 /* perf sample has 16 bits size limit */
79 #define PERF_SAMPLE_MAX_SIZE (1 << 16)
82 struct perf_event_header header;
97 struct sample_read_value {
108 struct sample_read_value *values;
110 struct sample_read_value one;
128 struct ip_callchain *callchain;
129 struct branch_stack *branch_stack;
130 struct regs_dump user_regs;
131 struct stack_dump user_stack;
132 struct sample_read read;
135 #define PERF_MEM_DATA_SRC_NONE \
136 (PERF_MEM_S(OP, NA) |\
137 PERF_MEM_S(LVL, NA) |\
138 PERF_MEM_S(SNOOP, NA) |\
139 PERF_MEM_S(LOCK, NA) |\
142 struct build_id_event {
143 struct perf_event_header header;
145 u8 build_id[PERF_ALIGN(BUILD_ID_SIZE, sizeof(u64))];
149 enum perf_user_event_type { /* above any possible kernel type */
150 PERF_RECORD_USER_TYPE_START = 64,
151 PERF_RECORD_HEADER_ATTR = 64,
152 PERF_RECORD_HEADER_EVENT_TYPE = 65, /* depreceated */
153 PERF_RECORD_HEADER_TRACING_DATA = 66,
154 PERF_RECORD_HEADER_BUILD_ID = 67,
155 PERF_RECORD_FINISHED_ROUND = 68,
156 PERF_RECORD_HEADER_MAX
160 struct perf_event_header header;
161 struct perf_event_attr attr;
165 #define MAX_EVENT_NAME 64
167 struct perf_trace_event_type {
169 char name[MAX_EVENT_NAME];
172 struct event_type_event {
173 struct perf_event_header header;
174 struct perf_trace_event_type event_type;
177 struct tracing_data_event {
178 struct perf_event_header header;
183 struct perf_event_header header;
184 struct mmap_event mmap;
185 struct mmap2_event mmap2;
186 struct comm_event comm;
187 struct fork_event fork;
188 struct lost_event lost;
189 struct read_event read;
190 struct throttle_event throttle;
191 struct sample_event sample;
192 struct attr_event attr;
193 struct event_type_event event_type;
194 struct tracing_data_event tracing_data;
195 struct build_id_event build_id;
198 void perf_event__print_totals(void);
203 typedef int (*perf_event__handler_t)(struct perf_tool *tool,
204 union perf_event *event,
205 struct perf_sample *sample,
206 struct machine *machine);
208 int perf_event__synthesize_thread_map(struct perf_tool *tool,
209 struct thread_map *threads,
210 perf_event__handler_t process,
211 struct machine *machine, bool mmap_data);
212 int perf_event__synthesize_threads(struct perf_tool *tool,
213 perf_event__handler_t process,
214 struct machine *machine, bool mmap_data);
215 int perf_event__synthesize_kernel_mmap(struct perf_tool *tool,
216 perf_event__handler_t process,
217 struct machine *machine,
218 const char *symbol_name);
220 int perf_event__synthesize_modules(struct perf_tool *tool,
221 perf_event__handler_t process,
222 struct machine *machine);
224 int perf_event__process_comm(struct perf_tool *tool,
225 union perf_event *event,
226 struct perf_sample *sample,
227 struct machine *machine);
228 int perf_event__process_lost(struct perf_tool *tool,
229 union perf_event *event,
230 struct perf_sample *sample,
231 struct machine *machine);
232 int perf_event__process_mmap(struct perf_tool *tool,
233 union perf_event *event,
234 struct perf_sample *sample,
235 struct machine *machine);
236 int perf_event__process_mmap2(struct perf_tool *tool,
237 union perf_event *event,
238 struct perf_sample *sample,
239 struct machine *machine);
240 int perf_event__process_fork(struct perf_tool *tool,
241 union perf_event *event,
242 struct perf_sample *sample,
243 struct machine *machine);
244 int perf_event__process_exit(struct perf_tool *tool,
245 union perf_event *event,
246 struct perf_sample *sample,
247 struct machine *machine);
248 int perf_event__process(struct perf_tool *tool,
249 union perf_event *event,
250 struct perf_sample *sample,
251 struct machine *machine);
253 struct addr_location;
255 int perf_event__preprocess_sample(const union perf_event *event,
256 struct machine *machine,
257 struct addr_location *al,
258 struct perf_sample *sample);
260 const char *perf_event__name(unsigned int id);
262 size_t perf_event__sample_event_size(const struct perf_sample *sample, u64 type,
263 u64 sample_regs_user, u64 read_format);
264 int perf_event__synthesize_sample(union perf_event *event, u64 type,
265 u64 sample_regs_user, u64 read_format,
266 const struct perf_sample *sample,
269 int perf_event__synthesize_mmap_events(struct perf_tool *tool,
270 union perf_event *event,
271 pid_t pid, pid_t tgid,
272 perf_event__handler_t process,
273 struct machine *machine,
276 size_t perf_event__fprintf_comm(union perf_event *event, FILE *fp);
277 size_t perf_event__fprintf_mmap(union perf_event *event, FILE *fp);
278 size_t perf_event__fprintf_mmap2(union perf_event *event, FILE *fp);
279 size_t perf_event__fprintf_task(union perf_event *event, FILE *fp);
280 size_t perf_event__fprintf(union perf_event *event, FILE *fp);
282 #endif /* __PERF_RECORD_H */