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 | |
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')
-rw-r--r-- | tools/perf/builtin-annotate.c | 2 | ||||
-rw-r--r-- | tools/perf/builtin-report.c | 2 | ||||
-rw-r--r-- | tools/perf/builtin-top.c | 2 | ||||
-rw-r--r-- | 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 132de8b28dbb..3becc8a35bee 100644 --- a/tools/perf/builtin-annotate.c +++ b/tools/perf/builtin-annotate.c | |||
@@ -172,7 +172,7 @@ static int load_kernel(void) | |||
172 | return -1; | 172 | return -1; |
173 | 173 | ||
174 | err = dso__load_kernel(kernel_dso, vmlinux, NULL, verbose); | 174 | err = dso__load_kernel(kernel_dso, vmlinux, NULL, verbose); |
175 | if (err) { | 175 | if (err <= 0) { |
176 | dso__delete(kernel_dso); | 176 | dso__delete(kernel_dso); |
177 | kernel_dso = NULL; | 177 | kernel_dso = NULL; |
178 | } else | 178 | } else |
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index be1b7584796d..58d1612894ff 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -189,7 +189,7 @@ static int load_kernel(void) | |||
189 | return -1; | 189 | return -1; |
190 | 190 | ||
191 | err = dso__load_kernel(kernel_dso, vmlinux, NULL, verbose); | 191 | err = dso__load_kernel(kernel_dso, vmlinux, NULL, verbose); |
192 | if (err) { | 192 | if (err <= 0) { |
193 | dso__delete(kernel_dso); | 193 | dso__delete(kernel_dso); |
194 | kernel_dso = NULL; | 194 | kernel_dso = NULL; |
195 | } else | 195 | } else |
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index cdc74cfb1517..97fde1d84365 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -364,7 +364,7 @@ static int parse_symbols(void) | |||
364 | if (kernel_dso == NULL) | 364 | if (kernel_dso == NULL) |
365 | return -1; | 365 | return -1; |
366 | 366 | ||
367 | if (dso__load_kernel(kernel_dso, NULL, symbol_filter, 1) != 0) | 367 | if (dso__load_kernel(kernel_dso, NULL, symbol_filter, 1) <= 0) |
368 | goto out_delete_dso; | 368 | goto out_delete_dso; |
369 | 369 | ||
370 | node = rb_first(&kernel_dso->syms); | 370 | node = rb_first(&kernel_dso->syms); |
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; |