summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/session.c
diff options
context:
space:
mode:
authorTom Zanussi <tzanussi@gmail.com>2010-04-01 23:59:20 -0500
committerIngo Molnar <mingo@elte.hu>2010-04-14 11:56:07 +0200
commitcd19a035f3b63fee6dcbdb5371c4b22276f7dc8c (patch)
tree0d0f6ce913a070372854d524bca068032dd3ff8f /tools/perf/util/session.c
parent2c46dbb517a10b18d459e6ceffefde5bfb290cf6 (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.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index bc81864cd04..96c4629b774 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)
handler->unthrottle = process_event_stub;
if (handler->attr == NULL)
handler->attr = process_event_stub;
+ if (handler->event_type == NULL)
+ handler->event_type = process_event_stub;
}
static const char *event__name[] = {
@@ -216,6 +218,7 @@ static const char *event__name[] = {
[PERF_RECORD_READ] = "READ",
[PERF_RECORD_SAMPLE] = "SAMPLE",
[PERF_RECORD_HEADER_ATTR] = "ATTR",
+ [PERF_RECORD_HEADER_EVENT_TYPE] = "EVENT_TYPE",
};
unsigned long event__total[PERF_RECORD_HEADER_MAX];
@@ -302,6 +305,12 @@ static void event__attr_swap(event_t *self)
mem_bswap_64(self->attr.id, size);
}
+static void event__event_type_swap(event_t *self)
+{
+ self->event_type.event_type.event_id =
+ bswap_64(self->event_type.event_type.event_id);
+}
+
typedef void (*event__swap_op)(event_t *self);
static event__swap_op event__swap_ops[] = {
@@ -313,6 +322,7 @@ static event__swap_op event__swap_ops[] = {
[PERF_RECORD_READ] = event__read_swap,
[PERF_RECORD_SAMPLE] = event__all64_swap,
[PERF_RECORD_HEADER_ATTR] = event__attr_swap,
+ [PERF_RECORD_HEADER_EVENT_TYPE] = event__event_type_swap,
[PERF_RECORD_HEADER_MAX] = NULL,
};
@@ -355,6 +365,8 @@ static int perf_session__process_event(struct perf_session *self,
return ops->unthrottle(event, self);
case PERF_RECORD_HEADER_ATTR:
return ops->attr(event, self);
+ case PERF_RECORD_HEADER_EVENT_TYPE:
+ return ops->event_type(event, self);
default:
self->unknown_events++;
return -1;