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
;
65 #define PERF_SAMPLE_MASK \
66 (PERF_SAMPLE_IP | PERF_SAMPLE_TID | \
67 PERF_SAMPLE_TIME | PERF_SAMPLE_ADDR | \
68 PERF_SAMPLE_ID | PERF_SAMPLE_STREAM_ID | \
69 PERF_SAMPLE_CPU | PERF_SAMPLE_PERIOD | \
70 PERF_SAMPLE_IDENTIFIER)
73 struct perf_event_header header
;
88 struct sample_read_value
{
99 struct sample_read_value
*values
;
101 struct sample_read_value one
;
118 struct ip_callchain
*callchain
;
119 struct branch_stack
*branch_stack
;
120 struct regs_dump user_regs
;
121 struct stack_dump user_stack
;
122 struct sample_read read
;
125 #define PERF_MEM_DATA_SRC_NONE \
126 (PERF_MEM_S(OP, NA) |\
127 PERF_MEM_S(LVL, NA) |\
128 PERF_MEM_S(SNOOP, NA) |\
129 PERF_MEM_S(LOCK, NA) |\
132 struct build_id_event
{
133 struct perf_event_header header
;
135 u8 build_id
[PERF_ALIGN(BUILD_ID_SIZE
, sizeof(u64
))];
139 enum perf_user_event_type
{ /* above any possible kernel type */
140 PERF_RECORD_USER_TYPE_START
= 64,
141 PERF_RECORD_HEADER_ATTR
= 64,
142 PERF_RECORD_HEADER_EVENT_TYPE
= 65, /* depreceated */
143 PERF_RECORD_HEADER_TRACING_DATA
= 66,
144 PERF_RECORD_HEADER_BUILD_ID
= 67,
145 PERF_RECORD_FINISHED_ROUND
= 68,
146 PERF_RECORD_HEADER_MAX
150 struct perf_event_header header
;
151 struct perf_event_attr attr
;
155 #define MAX_EVENT_NAME 64
157 struct perf_trace_event_type
{
159 char name
[MAX_EVENT_NAME
];
162 struct event_type_event
{
163 struct perf_event_header header
;
164 struct perf_trace_event_type event_type
;
167 struct tracing_data_event
{
168 struct perf_event_header header
;
173 struct perf_event_header header
;
174 struct mmap_event mmap
;
175 struct mmap2_event mmap2
;
176 struct comm_event comm
;
177 struct fork_event fork
;
178 struct lost_event lost
;
179 struct read_event read
;
180 struct sample_event sample
;
181 struct attr_event attr
;
182 struct event_type_event event_type
;
183 struct tracing_data_event tracing_data
;
184 struct build_id_event build_id
;
187 void perf_event__print_totals(void);
192 typedef int (*perf_event__handler_t
)(struct perf_tool
*tool
,
193 union perf_event
*event
,
194 struct perf_sample
*sample
,
195 struct machine
*machine
);
197 int perf_event__synthesize_thread_map(struct perf_tool
*tool
,
198 struct thread_map
*threads
,
199 perf_event__handler_t process
,
200 struct machine
*machine
);
201 int perf_event__synthesize_threads(struct perf_tool
*tool
,
202 perf_event__handler_t process
,
203 struct machine
*machine
);
204 int perf_event__synthesize_kernel_mmap(struct perf_tool
*tool
,
205 perf_event__handler_t process
,
206 struct machine
*machine
,
207 const char *symbol_name
);
209 int perf_event__synthesize_modules(struct perf_tool
*tool
,
210 perf_event__handler_t process
,
211 struct machine
*machine
);
213 int perf_event__process_comm(struct perf_tool
*tool
,
214 union perf_event
*event
,
215 struct perf_sample
*sample
,
216 struct machine
*machine
);
217 int perf_event__process_lost(struct perf_tool
*tool
,
218 union perf_event
*event
,
219 struct perf_sample
*sample
,
220 struct machine
*machine
);
221 int perf_event__process_mmap(struct perf_tool
*tool
,
222 union perf_event
*event
,
223 struct perf_sample
*sample
,
224 struct machine
*machine
);
225 int perf_event__process_mmap2(struct perf_tool
*tool
,
226 union perf_event
*event
,
227 struct perf_sample
*sample
,
228 struct machine
*machine
);
229 int perf_event__process_fork(struct perf_tool
*tool
,
230 union perf_event
*event
,
231 struct perf_sample
*sample
,
232 struct machine
*machine
);
233 int perf_event__process_exit(struct perf_tool
*tool
,
234 union perf_event
*event
,
235 struct perf_sample
*sample
,
236 struct machine
*machine
);
237 int perf_event__process(struct perf_tool
*tool
,
238 union perf_event
*event
,
239 struct perf_sample
*sample
,
240 struct machine
*machine
);
242 struct addr_location
;
243 int perf_event__preprocess_sample(const union perf_event
*self
,
244 struct machine
*machine
,
245 struct addr_location
*al
,
246 struct perf_sample
*sample
);
248 const char *perf_event__name(unsigned int id
);
250 size_t perf_event__sample_event_size(const struct perf_sample
*sample
, u64 type
,
251 u64 sample_regs_user
, u64 read_format
);
252 int perf_event__synthesize_sample(union perf_event
*event
, u64 type
,
253 u64 sample_regs_user
, u64 read_format
,
254 const struct perf_sample
*sample
,
257 size_t perf_event__fprintf_comm(union perf_event
*event
, FILE *fp
);
258 size_t perf_event__fprintf_mmap(union perf_event
*event
, FILE *fp
);
259 size_t perf_event__fprintf_mmap2(union perf_event
*event
, FILE *fp
);
260 size_t perf_event__fprintf_task(union perf_event
*event
, FILE *fp
);
261 size_t perf_event__fprintf(union perf_event
*event
, FILE *fp
);
263 #endif /* __PERF_RECORD_H */