Skip to content

Commit

Permalink
perf script: Don't assume evsel position of tracking events
Browse files Browse the repository at this point in the history
The tracking event does not have to be the first event so replace
perf_evlist__first() with perf_evlist__id2evsel() which uses the event
ID to find the correct evsel.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: Jiri Olsa <jolsa@redhat.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Pawel Moll <pawel.moll@arm.com>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1437471846-26995-5-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 24, 2015
1 parent b757bb0 commit 06b234e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tools/perf/builtin-script.c
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ static int process_comm_event(struct perf_tool *tool,
struct thread *thread;
struct perf_script *script = container_of(tool, struct perf_script, tool);
struct perf_session *session = script->session;
struct perf_evsel *evsel = perf_evlist__first(session->evlist);
struct perf_evsel *evsel = perf_evlist__id2evsel(session->evlist, sample->id);
int ret = -1;

thread = machine__findnew_thread(machine, event->comm.pid, event->comm.tid);
Expand Down Expand Up @@ -695,7 +695,7 @@ static int process_fork_event(struct perf_tool *tool,
struct thread *thread;
struct perf_script *script = container_of(tool, struct perf_script, tool);
struct perf_session *session = script->session;
struct perf_evsel *evsel = perf_evlist__first(session->evlist);
struct perf_evsel *evsel = perf_evlist__id2evsel(session->evlist, sample->id);

if (perf_event__process_fork(tool, event, sample, machine) < 0)
return -1;
Expand Down Expand Up @@ -727,7 +727,7 @@ static int process_exit_event(struct perf_tool *tool,
struct thread *thread;
struct perf_script *script = container_of(tool, struct perf_script, tool);
struct perf_session *session = script->session;
struct perf_evsel *evsel = perf_evlist__first(session->evlist);
struct perf_evsel *evsel = perf_evlist__id2evsel(session->evlist, sample->id);

thread = machine__findnew_thread(machine, event->fork.pid, event->fork.tid);
if (thread == NULL) {
Expand Down Expand Up @@ -759,7 +759,7 @@ static int process_mmap_event(struct perf_tool *tool,
struct thread *thread;
struct perf_script *script = container_of(tool, struct perf_script, tool);
struct perf_session *session = script->session;
struct perf_evsel *evsel = perf_evlist__first(session->evlist);
struct perf_evsel *evsel = perf_evlist__id2evsel(session->evlist, sample->id);

if (perf_event__process_mmap(tool, event, sample, machine) < 0)
return -1;
Expand Down Expand Up @@ -790,7 +790,7 @@ static int process_mmap2_event(struct perf_tool *tool,
struct thread *thread;
struct perf_script *script = container_of(tool, struct perf_script, tool);
struct perf_session *session = script->session;
struct perf_evsel *evsel = perf_evlist__first(session->evlist);
struct perf_evsel *evsel = perf_evlist__id2evsel(session->evlist, sample->id);

if (perf_event__process_mmap2(tool, event, sample, machine) < 0)
return -1;
Expand Down

0 comments on commit 06b234e

Please sign in to comment.