[PATCH 1/2] perf session: Add ability to 'skip' a non-piped event stream

Adrian Hunter
2014-07-23T19:21:09Z

A piped event stream may contain arbitary sized tracepoint
information following a PERF_RECORD_HEADER_TRACING_DATA
event. The position in the stream has to be 'skipped'
to match the start of the next event.

Provide the same ability to a non-piped event stream
to allow for Instruction Trace data that may also be
in a non-piped event stream.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
tools/perf/util/session.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 8aa1be1..9d468e6 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -1320,6 +1320,7 @@ int __perf_session__process_events(struct perf_session *session,
union perf_event *event;
uint32_t size;
struct ui_progress prog;
+ int skip;

perf_tool__fill_defaults(tool);

@@ -1380,7 +1381,8 @@ more:
size = event->header.size;

if (size < sizeof(struct perf_event_header) ||
- perf_session__process_event(session, event, tool, file_pos) < 0) {
+ (skip = perf_session__process_event(session, event, tool, file_pos))
+ < 0) {
pr_err("%#" PRIx64 " [%#x]: failed to process type: %d\n",
file_offset + head, event->header.size,
event->header.type);
@@ -1388,6 +1390,9 @@ more:
goto out_err;
}

+ if (skip)
+ size += skip;
+
head += size;
file_pos += size;

--
1.8.3.2