Skip to content

Commit

Permalink
perf session: Add ability to 'skip' a non-piped event stream
Browse files Browse the repository at this point in the history
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>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1406143198-20732-1-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
  • Loading branch information
Adrian Hunter authored and Arnaldo Carvalho de Melo committed Jul 23, 2014
1 parent 2a03068 commit 6f917c7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tools/perf/util/session.c
Original file line number Diff line number Diff line change
Expand Up @@ -1284,6 +1284,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);

Expand Down Expand Up @@ -1344,14 +1345,18 @@ int __perf_session__process_events(struct perf_session *session,
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);
err = -EINVAL;
goto out_err;
}

if (skip)
size += skip;

head += size;
file_pos += size;

Expand Down

0 comments on commit 6f917c7

Please sign in to comment.