diff options
author | Mike Galbraith <efault@gmx.de> | 2009-07-02 02:05:58 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-07-02 02:42:20 -0400 |
commit | 9974f496782b7612e36a143bedda858f1cb953d4 (patch) | |
tree | 3552e4515a40691a9ae5e769117ee3676a6cab70 /tools/perf/util | |
parent | a92bef0f216bbf3d05c0c0709ea02e267f2b920e (diff) |
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>
Diffstat (limited to 'tools/perf/util')
-rw-r--r-- | tools/perf/util/symbol.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 78c2efde01b7..c077b6a14690 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 | |||
146 | char *line = NULL; | 146 | char *line = NULL; |
147 | size_t n; | 147 | size_t n; |
148 | FILE *file = fopen("/proc/kallsyms", "r"); | 148 | FILE *file = fopen("/proc/kallsyms", "r"); |
149 | int count = 0; | ||
149 | 150 | ||
150 | if (file == NULL) | 151 | if (file == NULL) |
151 | goto out_failure; | 152 | goto out_failure; |
@@ -188,8 +189,10 @@ static int dso__load_kallsyms(struct dso *self, symbol_filter_t filter, int verb | |||
188 | 189 | ||
189 | if (filter && filter(self, sym)) | 190 | if (filter && filter(self, sym)) |
190 | symbol__delete(sym, self->sym_priv_size); | 191 | symbol__delete(sym, self->sym_priv_size); |
191 | else | 192 | else { |
192 | dso__insert_symbol(self, sym); | 193 | dso__insert_symbol(self, sym); |
194 | count++; | ||
195 | } | ||
193 | } | 196 | } |
194 | 197 | ||
195 | /* | 198 | /* |
@@ -212,7 +215,7 @@ static int dso__load_kallsyms(struct dso *self, symbol_filter_t filter, int verb | |||
212 | free(line); | 215 | free(line); |
213 | fclose(file); | 216 | fclose(file); |
214 | 217 | ||
215 | return 0; | 218 | return count; |
216 | 219 | ||
217 | out_delete_line: | 220 | out_delete_line: |
218 | free(line); | 221 | free(line); |
@@ -639,7 +642,7 @@ int dso__load_kernel(struct dso *self, const char *vmlinux, | |||
639 | if (vmlinux) | 642 | if (vmlinux) |
640 | err = dso__load_vmlinux(self, vmlinux, filter, verbose); | 643 | err = dso__load_vmlinux(self, vmlinux, filter, verbose); |
641 | 644 | ||
642 | if (err < 0) | 645 | if (err <= 0) |
643 | err = dso__load_kallsyms(self, filter, verbose); | 646 | err = dso__load_kallsyms(self, filter, verbose); |
644 | 647 | ||
645 | return err; | 648 | return err; |