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.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 2c1277cb4ae4..bc81864cd04e 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -200,6 +200,8 @@ static void perf_event_ops__fill_defaults(struct perf_event_ops *handler)
200 handler->throttle = process_event_stub; 200 handler->throttle = process_event_stub;
201 if (handler->unthrottle == NULL) 201 if (handler->unthrottle == NULL)
202 handler->unthrottle = process_event_stub; 202 handler->unthrottle = process_event_stub;
203 if (handler->attr == NULL)
204 handler->attr = process_event_stub;
203} 205}
204 206
205static const char *event__name[] = { 207static const char *event__name[] = {
@@ -213,6 +215,7 @@ static const char *event__name[] = {
213 [PERF_RECORD_FORK] = "FORK", 215 [PERF_RECORD_FORK] = "FORK",
214 [PERF_RECORD_READ] = "READ", 216 [PERF_RECORD_READ] = "READ",
215 [PERF_RECORD_SAMPLE] = "SAMPLE", 217 [PERF_RECORD_SAMPLE] = "SAMPLE",
218 [PERF_RECORD_HEADER_ATTR] = "ATTR",
216}; 219};
217 220
218unsigned long event__total[PERF_RECORD_HEADER_MAX]; 221unsigned long event__total[PERF_RECORD_HEADER_MAX];
@@ -279,6 +282,26 @@ static void event__read_swap(event_t *self)
279 self->read.id = bswap_64(self->read.id); 282 self->read.id = bswap_64(self->read.id);
280} 283}
281 284
285static void event__attr_swap(event_t *self)
286{
287 size_t size;
288
289 self->attr.attr.type = bswap_32(self->attr.attr.type);
290 self->attr.attr.size = bswap_32(self->attr.attr.size);
291 self->attr.attr.config = bswap_64(self->attr.attr.config);
292 self->attr.attr.sample_period = bswap_64(self->attr.attr.sample_period);
293 self->attr.attr.sample_type = bswap_64(self->attr.attr.sample_type);
294 self->attr.attr.read_format = bswap_64(self->attr.attr.read_format);
295 self->attr.attr.wakeup_events = bswap_32(self->attr.attr.wakeup_events);
296 self->attr.attr.bp_type = bswap_32(self->attr.attr.bp_type);
297 self->attr.attr.bp_addr = bswap_64(self->attr.attr.bp_addr);
298 self->attr.attr.bp_len = bswap_64(self->attr.attr.bp_len);
299
300 size = self->header.size;
301 size -= (void *)&self->attr.id - (void *)self;
302 mem_bswap_64(self->attr.id, size);
303}
304
282typedef void (*event__swap_op)(event_t *self); 305typedef void (*event__swap_op)(event_t *self);
283 306
284static event__swap_op event__swap_ops[] = { 307static event__swap_op event__swap_ops[] = {
@@ -289,6 +312,7 @@ static event__swap_op event__swap_ops[] = {
289 [PERF_RECORD_LOST] = event__all64_swap, 312 [PERF_RECORD_LOST] = event__all64_swap,
290 [PERF_RECORD_READ] = event__read_swap, 313 [PERF_RECORD_READ] = event__read_swap,
291 [PERF_RECORD_SAMPLE] = event__all64_swap, 314 [PERF_RECORD_SAMPLE] = event__all64_swap,
315 [PERF_RECORD_HEADER_ATTR] = event__attr_swap,
292 [PERF_RECORD_HEADER_MAX] = NULL, 316 [PERF_RECORD_HEADER_MAX] = NULL,
293}; 317};
294 318
@@ -329,6 +353,8 @@ static int perf_session__process_event(struct perf_session *self,
329 return ops->throttle(event, self); 353 return ops->throttle(event, self);
330 case PERF_RECORD_UNTHROTTLE: 354 case PERF_RECORD_UNTHROTTLE:
331 return ops->unthrottle(event, self); 355 return ops->unthrottle(event, self);
356 case PERF_RECORD_HEADER_ATTR:
357 return ops->attr(event, self);
332 default: 358 default:
333 self->unknown_events++; 359 self->unknown_events++;
334 return -1; 360 return -1;