Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933126AbdLRH35 (ORCPT ); Mon, 18 Dec 2017 02:29:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:60652 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933039AbdLRH3z (ORCPT ); Mon, 18 Dec 2017 02:29:55 -0500 DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E40F521896 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=mhiramat@kernel.org From: Masami Hiramatsu To: Arnaldo Carvalho de Melo Cc: Masami Hiramatsu , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Subject: [PATCH 2/2] perf-probe: Skip searching debuginfo if we know no debuginfo Date: Mon, 18 Dec 2017 16:29:31 +0900 Message-Id: <151358217136.25261.3482350938716300995.stgit@devbox> X-Mailer: git-send-email 2.13.6 In-Reply-To: <151358211494.25261.16134489192749792799.stgit@devbox> References: <151358211494.25261.16134489192749792799.stgit@devbox> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1600 Lines: 51 Skip searching debuginfo if we have already searched and there is no debuginfo for given file. This also reduce debuginfo mismatch warnings for listing events on same binary. Signed-off-by: Masami Hiramatsu --- tools/perf/util/probe-finder.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c index 5bb71e056b21..cafc3e5b9863 100644 --- a/tools/perf/util/probe-finder.c +++ b/tools/perf/util/probe-finder.c @@ -119,6 +119,8 @@ enum dso_binary_type distro_dwarf_types[] = { struct debuginfo *debuginfo__new(const char *path) { + static struct strlist *no_debuginfo_files; + u8 bid[BUILD_ID_SIZE], bid2[BUILD_ID_SIZE]; enum dso_binary_type *type; char buf[PATH_MAX], nil = '\0'; @@ -126,6 +128,12 @@ struct debuginfo *debuginfo__new(const char *path) bool have_build_id = false; struct debuginfo *dinfo = NULL; + /* Skip if we already know it has no debuginfo */ + if (!no_debuginfo_files) + no_debuginfo_files = strlist__new(NULL, NULL); + else if (strlist__find(no_debuginfo_files, path)) + return NULL; + /* Try to open distro debuginfo files */ dso = dso__new(path); if (!dso) @@ -159,7 +167,13 @@ struct debuginfo *debuginfo__new(const char *path) out: /* if failed to open all distro debuginfo, open given binary */ - return dinfo ? : __debuginfo__new(path); + if (!dinfo) { + dinfo = __debuginfo__new(path); + if (!dinfo) + strlist__add(no_debuginfo_files, path); + } + + return dinfo; } void debuginfo__delete(struct debuginfo *dbg)