aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/session.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/session.c')
-rw-r--r--tools/perf/util/session.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 96c4629b7740..1516c40d47ac 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -204,6 +204,8 @@ static void perf_event_ops__fill_defaults(struct perf_event_ops *handler)
204 handler->attr = process_event_stub; 204 handler->attr = process_event_stub;
205 if (handler->event_type == NULL) 205 if (handler->event_type == NULL)
206 handler->event_type = process_event_stub; 206 handler->event_type = process_event_stub;
207 if (handler->tracing_data == NULL)
208 handler->tracing_data = process_event_stub;
207} 209}
208 210
209static const char *event__name[] = { 211static const char *event__name[] = {
@@ -219,6 +221,7 @@ static const char *event__name[] = {
219 [PERF_RECORD_SAMPLE] = "SAMPLE", 221 [PERF_RECORD_SAMPLE] = "SAMPLE",
220 [PERF_RECORD_HEADER_ATTR] = "ATTR", 222 [PERF_RECORD_HEADER_ATTR] = "ATTR",
221 [PERF_RECORD_HEADER_EVENT_TYPE] = "EVENT_TYPE", 223 [PERF_RECORD_HEADER_EVENT_TYPE] = "EVENT_TYPE",
224 [PERF_RECORD_HEADER_TRACING_DATA] = "TRACING_DATA",
222}; 225};
223 226
224unsigned long event__total[PERF_RECORD_HEADER_MAX]; 227unsigned long event__total[PERF_RECORD_HEADER_MAX];
@@ -311,6 +314,11 @@ static void event__event_type_swap(event_t *self)
311 bswap_64(self->event_type.event_type.event_id); 314 bswap_64(self->event_type.event_type.event_id);
312} 315}
313 316
317static void event__tracing_data_swap(event_t *self)
318{
319 self->tracing_data.size = bswap_32(self->tracing_data.size);
320}
321
314typedef void (*event__swap_op)(event_t *self); 322typedef void (*event__swap_op)(event_t *self);
315 323
316static event__swap_op event__swap_ops[] = { 324static event__swap_op event__swap_ops[] = {
@@ -323,6 +331,7 @@ static event__swap_op event__swap_ops[] = {
323 [PERF_RECORD_SAMPLE] = event__all64_swap, 331 [PERF_RECORD_SAMPLE] = event__all64_swap,
324 [PERF_RECORD_HEADER_ATTR] = event__attr_swap, 332 [PERF_RECORD_HEADER_ATTR] = event__attr_swap,
325 [PERF_RECORD_HEADER_EVENT_TYPE] = event__event_type_swap, 333 [PERF_RECORD_HEADER_EVENT_TYPE] = event__event_type_swap,
334 [PERF_RECORD_HEADER_TRACING_DATA] = event__tracing_data_swap,
326 [PERF_RECORD_HEADER_MAX] = NULL, 335 [PERF_RECORD_HEADER_MAX] = NULL,
327}; 336};
328 337
@@ -367,6 +376,10 @@ static int perf_session__process_event(struct perf_session *self,
367 return ops->attr(event, self); 376 return ops->attr(event, self);
368 case PERF_RECORD_HEADER_EVENT_TYPE: 377 case PERF_RECORD_HEADER_EVENT_TYPE:
369 return ops->event_type(event, self); 378 return ops->event_type(event, self);
379 case PERF_RECORD_HEADER_TRACING_DATA:
380 /* setup for reading amidst mmap */
381 lseek(self->fd, offset + head, SEEK_SET);
382 return ops->tracing_data(event, self);
370 default: 383 default:
371 self->unknown_events++; 384 self->unknown_events++;
372 return -1; 385 return -1;