From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753820AbbG2IP7 (ORCPT ); Wed, 29 Jul 2015 04:15:59 -0400 Received: from terminus.zytor.com ([198.137.202.10]:57017 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752988AbbG2IP4 (ORCPT ); Wed, 29 Jul 2015 04:15:56 -0400 Date: Wed, 29 Jul 2015 01:15:18 -0700 From: tip-bot for Adrian Hunter Message-ID: 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 Reply-To: acme@redhat.com, pawel.moll@arm.com, mingo@kernel.org, mathieu.poirier@linaro.org, eranian@google.com, linux-kernel@vger.kernel.org, adrian.hunter@intel.com, hpa@zytor.com, peterz@infradead.org, ak@linux.intel.com, jolsa@redhat.com, tglx@linutronix.de In-Reply-To: <1437471846-26995-5-git-send-email-adrian.hunter@intel.com> References: <1437471846-26995-5-git-send-email-adrian.hunter@intel.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf script: Don' t assume evsel position of tracking events Git-Commit-ID: 06b234ec26fde8d0fce54030fe0858e218636410 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 06b234ec26fde8d0fce54030fe0858e218636410 Gitweb: http://git.kernel.org/tip/06b234ec26fde8d0fce54030fe0858e218636410 Author: Adrian Hunter AuthorDate: Tue, 21 Jul 2015 12:44:05 +0300 Committer: Arnaldo Carvalho de Melo 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 Acked-by: Peter Zijlstra (Intel) Tested-by: Jiri Olsa Cc: Andi Kleen Cc: Mathieu Poirier Cc: Pawel Moll Cc: Stephane Eranian Link: http://lkml.kernel.org/r/1437471846-26995-5-git-send-email-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo --- 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;