diff options
author | Tom Zanussi <tzanussi@gmail.com> | 2010-04-02 00:59:21 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-04-14 05:56:07 -0400 |
commit | 9215545e99d8c0b27323df2de504f4294bf5e407 (patch) | |
tree | b53dde70374d2f8a8cd12c44c3637665e559cb16 /tools/perf/util/session.c | |
parent | cd19a035f3b63fee6dcbdb5371c4b22276f7dc8c (diff) |
perf: Convert perf tracing data into a tracing_data event
Bypasses the tracing_data 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.
The tracing data is pretty large, and this patch doesn't attempt
to break it down into component events. The tracing_data event
itself doesn't actually contain the tracing data, rather it
arranges for the event processing code to skip over it after
it's read, using the skip return value added to the event
processing loop in a previous patch.
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-8-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 | 13 |
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 | ||
209 | static const char *event__name[] = { | 211 | static 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 | ||
224 | unsigned long event__total[PERF_RECORD_HEADER_MAX]; | 227 | unsigned 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 | ||
317 | static void event__tracing_data_swap(event_t *self) | ||
318 | { | ||
319 | self->tracing_data.size = bswap_32(self->tracing_data.size); | ||
320 | } | ||
321 | |||
314 | typedef void (*event__swap_op)(event_t *self); | 322 | typedef void (*event__swap_op)(event_t *self); |
315 | 323 | ||
316 | static event__swap_op event__swap_ops[] = { | 324 | static 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; |