linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@kernel.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
	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	[thread overview]
Message-ID: <151358217136.25261.3482350938716300995.stgit@devbox> (raw)
In-Reply-To: <151358211494.25261.16134489192749792799.stgit@devbox>

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 <mhiramat@kernel.org>
---
 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)

  parent reply	other threads:[~2017-12-18  7:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-18  7:28 [PATCH 0/2] perf-probe: Improve warning message for buildid mismatch Masami Hiramatsu
2017-12-18  7:29 ` [PATCH 1/2] perf-probe: Ensure debuginfo's build-id is correct Masami Hiramatsu
2018-01-04 16:17   ` Arnaldo Carvalho de Melo
2018-01-06 14:11     ` Masami Hiramatsu
2018-01-11 12:31     ` Masami Hiramatsu
2018-01-11 14:59       ` Arnaldo Carvalho de Melo
2018-01-11 15:06         ` Arnaldo Carvalho de Melo
2018-01-11 16:21           ` Masami Hiramatsu
2017-12-18  7:29 ` Masami Hiramatsu [this message]
2017-12-29  2:52 ` [PATCH 0/2] perf-probe: Improve warning message for buildid mismatch Masami Hiramatsu
2018-01-03  6:51 ` Ravi Bangoria

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=151358217136.25261.3482350938716300995.stgit@devbox \
    --to=mhiramat@kernel.org \
    --cc=acme@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).