From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757191AbbE2Sid (ORCPT ); Fri, 29 May 2015 14:38:33 -0400 Received: from terminus.zytor.com ([198.137.202.10]:35224 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756916AbbE2SiX (ORCPT ); Fri, 29 May 2015 14:38:23 -0400 Date: Fri, 29 May 2015 11:38:09 -0700 From: tip-bot for Arnaldo Carvalho de Melo Message-ID: Cc: namhyung@kernel.org, acme@redhat.com, linux-kernel@vger.kernel.org, jolsa@redhat.com, dsahern@gmail.com, tglx@linutronix.de, adrian.hunter@intel.com, mingo@kernel.org, hpa@zytor.com Reply-To: adrian.hunter@intel.com, hpa@zytor.com, mingo@kernel.org, tglx@linutronix.de, dsahern@gmail.com, jolsa@redhat.com, linux-kernel@vger.kernel.org, acme@redhat.com, namhyung@kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf machine: Introduce machine__findnew_dso() method Git-Commit-ID: aa7cc2ae5ae69aff555793fbfcff514141bb23f3 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: aa7cc2ae5ae69aff555793fbfcff514141bb23f3 Gitweb: http://git.kernel.org/tip/aa7cc2ae5ae69aff555793fbfcff514141bb23f3 Author: Arnaldo Carvalho de Melo AuthorDate: Fri, 29 May 2015 11:31:12 -0300 Committer: Arnaldo Carvalho de Melo CommitDate: Fri, 29 May 2015 12:43:44 -0300 perf machine: Introduce machine__findnew_dso() method Similar to machine__findnew_thread(), also prepping for refcounting and locking, this time for struct dso instances. Cc: Adrian Hunter Cc: David Ahern Cc: Jiri Olsa Cc: Namhyung Kim Link: http://lkml.kernel.org/n/tip-fv3tshv5o1413coh147lszjc@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/tests/hists_common.c | 3 +-- tools/perf/util/dso.c | 2 +- tools/perf/util/header.c | 2 +- tools/perf/util/machine.c | 7 ++++++- tools/perf/util/machine.h | 2 ++ tools/perf/util/map.c | 2 +- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/tools/perf/tests/hists_common.c b/tools/perf/tests/hists_common.c index bcde1d2..915f60a 100644 --- a/tools/perf/tests/hists_common.c +++ b/tools/perf/tests/hists_common.c @@ -121,8 +121,7 @@ struct machine *setup_fake_machine(struct machines *machines) size_t k; struct dso *dso; - dso = __dsos__findnew(&machine->dsos, - fake_symbols[i].dso_name); + dso = machine__findnew_dso(machine, fake_symbols[i].dso_name); if (dso == NULL) goto out; diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c index ff040b0..b335db3 100644 --- a/tools/perf/util/dso.c +++ b/tools/perf/util/dso.c @@ -833,7 +833,7 @@ struct dso *machine__findnew_kernel(struct machine *machine, const char *name, /* * The kernel dso could be created by build_id processing. */ - struct dso *dso = __dsos__findnew(&machine->dsos, name); + struct dso *dso = machine__findnew_dso(machine, name); /* * We need to run this in all cases, since during the build_id diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index a900e94..851143a 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c @@ -1264,7 +1264,7 @@ static int __event_process_build_id(struct build_id_event *bev, goto out; } - dso = __dsos__findnew(&machine->dsos, filename); + dso = machine__findnew_dso(machine, filename); if (dso != NULL) { char sbuild_id[BUILD_ID_SIZE * 2 + 1]; diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index ffd3107..698da1da 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c @@ -1157,7 +1157,7 @@ static int machine__process_kernel_mmap_event(struct machine *machine, } if (kernel == NULL) - kernel = __dsos__findnew(&machine->dsos, kmmap_prefix); + kernel = machine__findnew_dso(machine, kmmap_prefix); if (kernel == NULL) goto out_problem; @@ -1915,3 +1915,8 @@ int machine__get_kernel_start(struct machine *machine) } return err; } + +struct dso *machine__findnew_dso(struct machine *machine, const char *filename) +{ + return __dsos__findnew(&machine->dsos, filename); +} diff --git a/tools/perf/util/machine.h b/tools/perf/util/machine.h index aabca58..39a0ca0 100644 --- a/tools/perf/util/machine.h +++ b/tools/perf/util/machine.h @@ -154,6 +154,8 @@ static inline bool machine__is_host(struct machine *machine) struct thread *__machine__findnew_thread(struct machine *machine, pid_t pid, pid_t tid); struct thread *machine__findnew_thread(struct machine *machine, pid_t pid, pid_t tid); +struct dso *machine__findnew_dso(struct machine *machine, const char *filename); + size_t machine__fprintf(struct machine *machine, FILE *fp); static inline diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c index 57ff025..d15e1e9 100644 --- a/tools/perf/util/map.c +++ b/tools/perf/util/map.c @@ -180,7 +180,7 @@ struct map *map__new(struct machine *machine, u64 start, u64 len, pgoff = 0; dso = vdso__dso_findnew(machine, thread); } else - dso = __dsos__findnew(&machine->dsos, filename); + dso = machine__findnew_dso(machine, filename); if (dso == NULL) goto out_delete;