diff options
author | Tom Zanussi <tzanussi@gmail.com> | 2010-04-02 00:59:20 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-04-14 05:56:07 -0400 |
commit | cd19a035f3b63fee6dcbdb5371c4b22276f7dc8c (patch) | |
tree | 0d0f6ce913a070372854d524bca068032dd3ff8f /tools/perf/util/session.c | |
parent | 2c46dbb517a10b18d459e6ceffefde5bfb290cf6 (diff) |
perf: Convert perf event types into event type events
Bypasses the event type perf header code and replaces it with a
synthesized event and processing function that accomplishes the
same thing, used when reading/writing perf data to/from a pipe.
Signed-off-by: Tom Zanussi <tzanussi@gmail.com>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Cc: fweisbec@gmail.com
Cc: rostedt@goodmis.org
Cc: k-keiichi@bx.jp.nec.com
Cc: acme@ghostprotocols.net
LKML-Reference: <1270184365-8281-7-git-send-email-tzanussi@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/util/session.c')
-rw-r--r-- | tools/perf/util/session.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index bc81864cd04e..96c4629b7740 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c | |||
@@ -202,6 +202,8 @@ static void perf_event_ops__fill_defaults(struct perf_event_ops *handler) | |||
202 | handler->unthrottle = process_event_stub; | 202 | handler->unthrottle = process_event_stub; |
203 | if (handler->attr == NULL) | 203 | if (handler->attr == NULL) |
204 | handler->attr = process_event_stub; | 204 | handler->attr = process_event_stub; |
205 | if (handler->event_type == NULL) | ||
206 | handler->event_type = process_event_stub; | ||
205 | } | 207 | } |
206 | 208 | ||
207 | static const char *event__name[] = { | 209 | static const char *event__name[] = { |
@@ -216,6 +218,7 @@ static const char *event__name[] = { | |||
216 | [PERF_RECORD_READ] = "READ", | 218 | [PERF_RECORD_READ] = "READ", |
217 | [PERF_RECORD_SAMPLE] = "SAMPLE", | 219 | [PERF_RECORD_SAMPLE] = "SAMPLE", |
218 | [PERF_RECORD_HEADER_ATTR] = "ATTR", | 220 | [PERF_RECORD_HEADER_ATTR] = "ATTR", |
221 | [PERF_RECORD_HEADER_EVENT_TYPE] = "EVENT_TYPE", | ||
219 | }; | 222 | }; |
220 | 223 | ||
221 | unsigned long event__total[PERF_RECORD_HEADER_MAX]; | 224 | unsigned long event__total[PERF_RECORD_HEADER_MAX]; |
@@ -302,6 +305,12 @@ static void event__attr_swap(event_t *self) | |||
302 | mem_bswap_64(self->attr.id, size); | 305 | mem_bswap_64(self->attr.id, size); |
303 | } | 306 | } |
304 | 307 | ||
308 | static void event__event_type_swap(event_t *self) | ||
309 | { | ||
310 | self->event_type.event_type.event_id = | ||
311 | bswap_64(self->event_type.event_type.event_id); | ||
312 | } | ||
313 | |||
305 | typedef void (*event__swap_op)(event_t *self); | 314 | typedef void (*event__swap_op)(event_t *self); |
306 | 315 | ||
307 | static event__swap_op event__swap_ops[] = { | 316 | static event__swap_op event__swap_ops[] = { |
@@ -313,6 +322,7 @@ static event__swap_op event__swap_ops[] = { | |||
313 | [PERF_RECORD_READ] = event__read_swap, | 322 | [PERF_RECORD_READ] = event__read_swap, |
314 | [PERF_RECORD_SAMPLE] = event__all64_swap, | 323 | [PERF_RECORD_SAMPLE] = event__all64_swap, |
315 | [PERF_RECORD_HEADER_ATTR] = event__attr_swap, | 324 | [PERF_RECORD_HEADER_ATTR] = event__attr_swap, |
325 | [PERF_RECORD_HEADER_EVENT_TYPE] = event__event_type_swap, | ||
316 | [PERF_RECORD_HEADER_MAX] = NULL, | 326 | [PERF_RECORD_HEADER_MAX] = NULL, |
317 | }; | 327 | }; |
318 | 328 | ||
@@ -355,6 +365,8 @@ static int perf_session__process_event(struct perf_session *self, | |||
355 | return ops->unthrottle(event, self); | 365 | return ops->unthrottle(event, self); |
356 | case PERF_RECORD_HEADER_ATTR: | 366 | case PERF_RECORD_HEADER_ATTR: |
357 | return ops->attr(event, self); | 367 | return ops->attr(event, self); |
368 | case PERF_RECORD_HEADER_EVENT_TYPE: | ||
369 | return ops->event_type(event, self); | ||
358 | default: | 370 | default: |
359 | self->unknown_events++; | 371 | self->unknown_events++; |
360 | return -1; | 372 | return -1; |