All of lore.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Mike Galbraith <efault@gmx.de>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, acme@redhat.com, paulus@samba.org,
	hpa@zytor.com, mingo@redhat.com, a.p.zijlstra@chello.nl,
	efault@gmx.de, tglx@linutronix.de, mingo@elte.hu
Subject: [tip:perfcounters/urgent] perf_counter tools: Make symbol loading consistently return number of loaded symbols
Date: Thu, 2 Jul 2009 07:06:31 GMT	[thread overview]
Message-ID: <tip-9974f496782b7612e36a143bedda858f1cb953d4@git.kernel.org> (raw)
In-Reply-To: <1246514758.13293.42.camel@marge.simson.net>

Commit-ID:  9974f496782b7612e36a143bedda858f1cb953d4
Gitweb:     http://git.kernel.org/tip/9974f496782b7612e36a143bedda858f1cb953d4
Author:     Mike Galbraith <efault@gmx.de>
AuthorDate: Thu, 2 Jul 2009 08:05:58 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 2 Jul 2009 08:42:20 +0200

perf_counter tools: Make symbol loading consistently return number of loaded symbols

perf_counter tools: Make symbol loading consistently return number of loaded symbols.

Signed-off-by: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <1246514758.13293.42.camel@marge.simson.net>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 tools/perf/builtin-annotate.c |    2 +-
 tools/perf/builtin-report.c   |    2 +-
 tools/perf/builtin-top.c      |    2 +-
 tools/perf/util/symbol.c      |    9 ++++++---
 4 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 132de8b..3becc8a 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -172,7 +172,7 @@ static int load_kernel(void)
 		return -1;
 
 	err = dso__load_kernel(kernel_dso, vmlinux, NULL, verbose);
-	if (err) {
+	if (err <= 0) {
 		dso__delete(kernel_dso);
 		kernel_dso = NULL;
 	} else
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index be1b758..58d1612 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -189,7 +189,7 @@ static int load_kernel(void)
 		return -1;
 
 	err = dso__load_kernel(kernel_dso, vmlinux, NULL, verbose);
-	if (err) {
+	if (err <= 0) {
 		dso__delete(kernel_dso);
 		kernel_dso = NULL;
 	} else
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index cdc74cf..97fde1d 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -364,7 +364,7 @@ static int parse_symbols(void)
 	if (kernel_dso == NULL)
 		return -1;
 
-	if (dso__load_kernel(kernel_dso, NULL, symbol_filter, 1) != 0)
+	if (dso__load_kernel(kernel_dso, NULL, symbol_filter, 1) <= 0)
 		goto out_delete_dso;
 
 	node = rb_first(&kernel_dso->syms);
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 78c2efd..c077b6a 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -146,6 +146,7 @@ static int dso__load_kallsyms(struct dso *self, symbol_filter_t filter, int verb
 	char *line = NULL;
 	size_t n;
 	FILE *file = fopen("/proc/kallsyms", "r");
+	int count = 0;
 
 	if (file == NULL)
 		goto out_failure;
@@ -188,8 +189,10 @@ static int dso__load_kallsyms(struct dso *self, symbol_filter_t filter, int verb
 
 		if (filter && filter(self, sym))
 			symbol__delete(sym, self->sym_priv_size);
-		else
+		else {
 			dso__insert_symbol(self, sym);
+			count++;
+		}
 	}
 
 	/*
@@ -212,7 +215,7 @@ static int dso__load_kallsyms(struct dso *self, symbol_filter_t filter, int verb
 	free(line);
 	fclose(file);
 
-	return 0;
+	return count;
 
 out_delete_line:
 	free(line);
@@ -639,7 +642,7 @@ int dso__load_kernel(struct dso *self, const char *vmlinux,
 	if (vmlinux)
 		err = dso__load_vmlinux(self, vmlinux, filter, verbose);
 
-	if (err < 0)
+	if (err <= 0)
 		err = dso__load_kallsyms(self, filter, verbose);
 
 	return err;

  reply	other threads:[~2009-07-02  7:07 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-02  6:03 [patch 0/4] perf_counter tools: support annotation of live kernel modules Mike Galbraith
2009-07-02  6:05 ` [patch 1/4] perf_counter tools: Make symbol loading consistently return number of loaded symbols Mike Galbraith
2009-07-02  7:06   ` tip-bot for Mike Galbraith [this message]
2009-07-02  6:07 ` [patch 2/4] perf_counter tools: Add infrastructure to support loading of kernel module symbols Mike Galbraith
2009-07-02  7:06   ` [tip:perfcounters/urgent] " tip-bot for Mike Galbraith
2009-07-02  6:08 ` [patch 3/4] perf_counter tools: connect module support infrastructure to symbol loading infrastructure Mike Galbraith
2009-07-02  7:06   ` [tip:perfcounters/urgent] perf_counter tools: Connect " tip-bot for Mike Galbraith
2009-07-02  6:09 ` [patch 4/4] perf_counter tools: Enable kernel module symbol loading in tools Mike Galbraith
2009-07-02  7:07   ` [tip:perfcounters/urgent] " tip-bot for Mike Galbraith
2009-07-02  6:47 ` [patch 0/4] perf_counter tools: support annotation of live kernel modules Ingo Molnar
2009-07-02  7:17   ` Mike Galbraith
2009-07-02  7:42     ` Ingo Molnar
2009-07-02  7:55       ` Mike Galbraith
2009-07-03  7:27         ` Ingo Molnar
2009-07-03  7:36           ` Mike Galbraith
2009-07-02  8:42     ` Mike Galbraith
2009-07-02  8:53       ` Mike Galbraith
2009-07-03  7:29       ` Ingo Molnar
2009-07-03  8:00         ` Mike Galbraith
2009-07-03  8:15           ` Ingo Molnar
2009-07-03  8:28             ` Mike Galbraith
2009-07-03  8:53               ` Frederic Weisbecker
2009-07-02 12:10     ` Peter Zijlstra
2009-07-03  7:17       ` Mike Galbraith
2009-07-03  7:24         ` Ingo Molnar
2009-07-03  7:31           ` Jaswinder Singh Rajput
2009-07-03  8:41         ` Frederic Weisbecker
2009-07-03  8:53           ` Ingo Molnar

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=tip-9974f496782b7612e36a143bedda858f1cb953d4@git.kernel.org \
    --to=efault@gmx.de \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mingo@redhat.com \
    --cc=paulus@samba.org \
    --cc=tglx@linutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.