linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@infradead.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: linux-kernel@vger.kernel.org,
	"Arnaldo Carvalho de Melo" <acme@redhat.com>,
	"Frédéric Weisbecker" <fweisbec@gmail.com>,
	"Mike Galbraith" <efault@gmx.de>,
	"Peter Zijlstra" <a.p.zijlstra@chello.nl>,
	"Paul Mackerras" <paulus@samba.org>
Subject: [PATCH 2/9] perf symbols: Factor out dso__load_vmlinux_path()
Date: Wed, 27 Jan 2010 21:05:50 -0200	[thread overview]
Message-ID: <1264633557-17597-2-git-send-email-acme@infradead.org> (raw)
In-Reply-To: <1264633557-17597-1-git-send-email-acme@infradead.org>

From: Arnaldo Carvalho de Melo <acme@redhat.com>

So that we can call it directly from regression tests, and also to
reduce the size of dso__load_kernel_sym(), making it more clear.

Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/symbol.c |   38 ++++++++++++++++++++++++--------------
 tools/perf/util/symbol.h |    2 ++
 2 files changed, 26 insertions(+), 14 deletions(-)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index f1f609d..26ec603 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1578,6 +1578,27 @@ static int dso__load_vmlinux(struct dso *self, struct map *map,
 	return err;
 }
 
+int dso__load_vmlinux_path(struct dso *self, struct map *map,
+			   struct perf_session *session, symbol_filter_t filter)
+{
+	int i, err = 0;
+
+	pr_debug("Looking at the vmlinux_path (%d entries long)\n",
+		 vmlinux_path__nr_entries);
+
+	for (i = 0; i < vmlinux_path__nr_entries; ++i) {
+		err = dso__load_vmlinux(self, map, session, vmlinux_path[i],
+					filter);
+		if (err > 0) {
+			pr_debug("Using %s for symbols\n", vmlinux_path[i]);
+			dso__set_long_name(self, strdup(vmlinux_path[i]));
+			break;
+		}
+	}
+
+	return err;
+}
+
 static int dso__load_kernel_sym(struct dso *self, struct map *map,
 				struct perf_session *session, symbol_filter_t filter)
 {
@@ -1606,20 +1627,9 @@ static int dso__load_kernel_sym(struct dso *self, struct map *map,
 	}
 
 	if (vmlinux_path != NULL) {
-		int i;
-		pr_debug("Looking at the vmlinux_path (%d entries long)\n",
-			 vmlinux_path__nr_entries);
-		for (i = 0; i < vmlinux_path__nr_entries; ++i) {
-			err = dso__load_vmlinux(self, map, session,
-						vmlinux_path[i], filter);
-			if (err > 0) {
-				pr_debug("Using %s for symbols\n",
-					 vmlinux_path[i]);
-				dso__set_long_name(self,
-						   strdup(vmlinux_path[i]));
-				goto out_fixup;
-			}
-		}
+		err = dso__load_vmlinux_path(self, map, session, filter);
+		if (err > 0)
+			goto out_fixup;
 	}
 
 	/*
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index ffe0b0f..a94997a 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -129,6 +129,8 @@ struct perf_session;
 
 int dso__load(struct dso *self, struct map *map, struct perf_session *session,
 	      symbol_filter_t filter);
+int dso__load_vmlinux_path(struct dso *self, struct map *map,
+			   struct perf_session *session, symbol_filter_t filter);
 void dsos__fprintf(FILE *fp);
 size_t dsos__fprintf_buildid(FILE *fp, bool with_hits);
 
-- 
1.6.2.5


  reply	other threads:[~2010-01-27 23:07 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-27 23:05 [PATCH 1/9] perf top: Exit if specified --vmlinux can't be used Arnaldo Carvalho de Melo
2010-01-27 23:05 ` Arnaldo Carvalho de Melo [this message]
2010-01-27 23:05 ` [PATCH 3/9] perf symbols: Split helpers used when creating kernel dso object Arnaldo Carvalho de Melo
2010-01-27 23:05 ` [PATCH 4/9] perf session: Create kernel maps in the constructor Arnaldo Carvalho de Melo
2010-01-27 23:17   ` Masami Hiramatsu
2010-01-27 23:29     ` Arnaldo Carvalho de Melo
2010-01-28 16:28       ` Masami Hiramatsu
2010-01-28 18:29         ` Arnaldo Carvalho de Melo
2010-01-28 20:59           ` Masami Hiramatsu
2010-01-29  0:42             ` Arnaldo Carvalho de Melo
2010-01-29  7:01               ` Masami Hiramatsu
2010-01-27 23:05 ` [PATCH 5/9] perf symbols: Remove perf_session usage in symbols layer Arnaldo Carvalho de Melo
2010-01-27 23:05 ` [PATCH 6/9] perf: Ignore perf-archive temp file Arnaldo Carvalho de Melo
2010-01-29  9:33   ` [tip:perf/core] " tip-bot for John Kacur
2010-01-29  9:39   ` tip-bot for John Kacur
2010-01-27 23:05 ` [PATCH 7/9] tools/perf/perf.c: Clean up trivial style issues Arnaldo Carvalho de Melo
2010-01-29  9:32   ` [tip:perf/core] " tip-bot for Thiago Farina
2010-01-29  9:39   ` tip-bot for Thiago Farina
2010-01-27 23:05 ` [PATCH 8/9] perf symbols: Fixup vsyscall maps Arnaldo Carvalho de Melo
2010-01-27 23:05 ` [PATCH 9/9] perf symbols: Ditch vdso global variable Arnaldo Carvalho de Melo

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=1264633557-17597-2-git-send-email-acme@infradead.org \
    --to=acme@infradead.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=efault@gmx.de \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.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).