From: tip-bot for Adrian Hunter <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: mathieu.poirier@linaro.org, mingo@kernel.org, pawel.moll@arm.com,
acme@redhat.com, linux-kernel@vger.kernel.org,
eranian@google.com, jolsa@redhat.com, ak@linux.intel.com,
peterz@infradead.org, hpa@zytor.com, adrian.hunter@intel.com,
tglx@linutronix.de
Subject: [tip:perf/core] perf script: Don' t assume evsel position of tracking events
Date: Wed, 29 Jul 2015 01:15:18 -0700 [thread overview]
Message-ID: <tip-06b234ec26fde8d0fce54030fe0858e218636410@git.kernel.org> (raw)
In-Reply-To: <1437471846-26995-5-git-send-email-adrian.hunter@intel.com>
Commit-ID: 06b234ec26fde8d0fce54030fe0858e218636410
Gitweb: http://git.kernel.org/tip/06b234ec26fde8d0fce54030fe0858e218636410
Author: Adrian Hunter <adrian.hunter@intel.com>
AuthorDate: Tue, 21 Jul 2015 12:44:05 +0300
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 23 Jul 2015 22:51:14 -0300
perf script: Don't assume evsel position of tracking events
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>
---
tools/perf/builtin-script.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 2777c64..8a8e2ea 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -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);
@@ -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;
@@ -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) {
@@ -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;
@@ -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;
next prev parent reply other threads:[~2015-07-29 8:15 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-21 9:44 [PATCH V4 0/5] perf: Add PERF_RECORD_SWITCH to indicate context switches Adrian Hunter
2015-07-21 9:44 ` [PATCH V4 1/5] " Adrian Hunter
2015-07-21 10:29 ` Peter Zijlstra
2015-07-21 17:54 ` Arnaldo Carvalho de Melo
2015-07-21 18:15 ` Arnaldo Carvalho de Melo
2015-07-22 9:53 ` Jiri Olsa
2015-07-29 8:14 ` [tip:perf/core] " tip-bot for Adrian Hunter
2015-07-21 9:44 ` [PATCH V4 2/5] perf tools: Add new PERF_RECORD_SWITCH event Adrian Hunter
2015-07-29 8:14 ` [tip:perf/core] " tip-bot for Adrian Hunter
2015-07-21 9:44 ` [PATCH V4 3/5] perf record: Add option --switch-events to select PERF_RECORD_SWITCH events Adrian Hunter
2015-07-29 8:15 ` [tip:perf/core] " tip-bot for Adrian Hunter
2015-07-21 9:44 ` [PATCH V4 4/5] perf script: Don't assume evsel position of tracking events Adrian Hunter
2015-07-29 8:15 ` tip-bot for Adrian Hunter [this message]
2015-07-21 9:44 ` [PATCH V4 5/5] perf script: Add option --show-switch-events Adrian Hunter
2015-07-29 8:15 ` [tip:perf/core] " tip-bot for Adrian Hunter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-06b234ec26fde8d0fce54030fe0858e218636410@git.kernel.org \
--to=tipbot@zytor.com \
--cc=acme@redhat.com \
--cc=adrian.hunter@intel.com \
--cc=ak@linux.intel.com \
--cc=eranian@google.com \
--cc=hpa@zytor.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mathieu.poirier@linaro.org \
--cc=mingo@kernel.org \
--cc=pawel.moll@arm.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox