aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/header.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2010-12-02 11:10:21 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2010-12-04 20:05:19 -0500
commit640c03ce837fe8d4b56342aba376ea0da3960459 (patch)
treee954290ccacf032ab4d9052eac01710fda1b7fab /tools/perf/util/header.c
parentc980d1091810df13f21aabbce545fd98f545bbf7 (diff)
perf session: Parse sample earlier
At perf_session__process_event, so that we reduce the number of lines in eache tool sample processing routine that now receives a sample_data pointer already parsed. This will also be useful in the next patch, where we'll allow sample the identity fields in MMAP, FORK, EXIT, etc, when it will be possible to see (cpu, timestamp) just after before every event. Also validate callchains in perf_session__process_event, i.e. as early as possible, and keep a counter of the number of events discarded due to invalid callchains, warning the user about it if it happens. There is an assumption that was kept that all events have the same sample_type, that will be dealt with in the future, when this preexisting limitation will be removed. Tested-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Ian Munsie <imunsie@au1.ibm.com> Acked-by: Thomas Gleixner <tglx@linutronix.de> Cc: Frédéric Weisbecker <fweisbec@gmail.com> Cc: Ian Munsie <imunsie@au1.ibm.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Paul Mackerras <paulus@samba.org> Cc: Stephane Eranian <eranian@google.com> LKML-Reference: <1291318772-30880-4-git-send-email-acme@infradead.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/header.c')
-rw-r--r--tools/perf/util/header.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index f65d7dc127b6..fe652f3b0aa7 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -993,15 +993,14 @@ int event__synthesize_attr(struct perf_event_attr *attr, u16 ids, u64 *id,
993 ev->attr.header.type = PERF_RECORD_HEADER_ATTR; 993 ev->attr.header.type = PERF_RECORD_HEADER_ATTR;
994 ev->attr.header.size = size; 994 ev->attr.header.size = size;
995 995
996 err = process(ev, session); 996 err = process(ev, NULL, session);
997 997
998 free(ev); 998 free(ev);
999 999
1000 return err; 1000 return err;
1001} 1001}
1002 1002
1003int event__synthesize_attrs(struct perf_header *self, 1003int event__synthesize_attrs(struct perf_header *self, event__handler_t process,
1004 event__handler_t process,
1005 struct perf_session *session) 1004 struct perf_session *session)
1006{ 1005{
1007 struct perf_header_attr *attr; 1006 struct perf_header_attr *attr;
@@ -1071,7 +1070,7 @@ int event__synthesize_event_type(u64 event_id, char *name,
1071 ev.event_type.header.size = sizeof(ev.event_type) - 1070 ev.event_type.header.size = sizeof(ev.event_type) -
1072 (sizeof(ev.event_type.event_type.name) - size); 1071 (sizeof(ev.event_type.event_type.name) - size);
1073 1072
1074 err = process(&ev, session); 1073 err = process(&ev, NULL, session);
1075 1074
1076 return err; 1075 return err;
1077} 1076}
@@ -1126,7 +1125,7 @@ int event__synthesize_tracing_data(int fd, struct perf_event_attr *pattrs,
1126 ev.tracing_data.header.size = sizeof(ev.tracing_data); 1125 ev.tracing_data.header.size = sizeof(ev.tracing_data);
1127 ev.tracing_data.size = aligned_size; 1126 ev.tracing_data.size = aligned_size;
1128 1127
1129 process(&ev, session); 1128 process(&ev, NULL, session);
1130 1129
1131 err = read_tracing_data(fd, pattrs, nb_events); 1130 err = read_tracing_data(fd, pattrs, nb_events);
1132 write_padded(fd, NULL, 0, padding); 1131 write_padded(fd, NULL, 0, padding);
@@ -1186,7 +1185,7 @@ int event__synthesize_build_id(struct dso *pos, u16 misc,
1186 ev.build_id.header.size = sizeof(ev.build_id) + len; 1185 ev.build_id.header.size = sizeof(ev.build_id) + len;
1187 memcpy(&ev.build_id.filename, pos->long_name, pos->long_name_len); 1186 memcpy(&ev.build_id.filename, pos->long_name, pos->long_name_len);
1188 1187
1189 err = process(&ev, session); 1188 err = process(&ev, NULL, session);
1190 1189
1191 return err; 1190 return err;
1192} 1191}