diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2009-11-16 13:32:44 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-11-16 16:05:51 -0500 |
commit | 9e03eb2d512e7f3a1e562d4b922aa8b1891750b6 (patch) | |
tree | 299a1a7a41663d3e33b7f9ee9f00f2269e082040 | |
parent | 37562eac3767c7f07bb1a1329708ff6453e47570 (diff) |
perf tools: Introduce dsos__fprintf_buildid
To print the buildids in the list of dsos. Will be used by 'perf
buildid-list'
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
LKML-Reference: <1258396365-29217-4-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | tools/perf/util/symbol.c | 30 | ||||
-rw-r--r-- | tools/perf/util/symbol.h | 2 |
2 files changed, 28 insertions, 4 deletions
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 93e4b52ccfe4..53de9c4488d8 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c | |||
@@ -212,14 +212,21 @@ int build_id__sprintf(u8 *self, int len, char *bf) | |||
212 | return raw - self; | 212 | return raw - self; |
213 | } | 213 | } |
214 | 214 | ||
215 | size_t dso__fprintf(struct dso *self, FILE *fp) | 215 | size_t dso__fprintf_buildid(struct dso *self, FILE *fp) |
216 | { | 216 | { |
217 | char sbuild_id[BUILD_ID_SIZE * 2 + 1]; | 217 | char sbuild_id[BUILD_ID_SIZE * 2 + 1]; |
218 | struct rb_node *nd; | ||
219 | size_t ret; | ||
220 | 218 | ||
221 | build_id__sprintf(self->build_id, sizeof(self->build_id), sbuild_id); | 219 | build_id__sprintf(self->build_id, sizeof(self->build_id), sbuild_id); |
222 | ret = fprintf(fp, "dso: %s (%s)\n", self->short_name, sbuild_id); | 220 | return fprintf(fp, "%s", sbuild_id); |
221 | } | ||
222 | |||
223 | size_t dso__fprintf(struct dso *self, FILE *fp) | ||
224 | { | ||
225 | struct rb_node *nd; | ||
226 | size_t ret = fprintf(fp, "dso: %s (", self->short_name); | ||
227 | |||
228 | ret += dso__fprintf_buildid(self, fp); | ||
229 | ret += fprintf(fp, ")\n"); | ||
223 | 230 | ||
224 | for (nd = rb_first(&self->syms); nd; nd = rb_next(nd)) { | 231 | for (nd = rb_first(&self->syms); nd; nd = rb_next(nd)) { |
225 | struct symbol *pos = rb_entry(nd, struct symbol, rb_node); | 232 | struct symbol *pos = rb_entry(nd, struct symbol, rb_node); |
@@ -1428,6 +1435,21 @@ void dsos__fprintf(FILE *fp) | |||
1428 | dso__fprintf(pos, fp); | 1435 | dso__fprintf(pos, fp); |
1429 | } | 1436 | } |
1430 | 1437 | ||
1438 | size_t dsos__fprintf_buildid(FILE *fp) | ||
1439 | { | ||
1440 | struct dso *pos; | ||
1441 | size_t ret = 0; | ||
1442 | |||
1443 | list_for_each_entry(pos, &dsos, node) { | ||
1444 | ret += dso__fprintf_buildid(pos, fp); | ||
1445 | if (verbose) | ||
1446 | ret += fprintf(fp, " %s\n", pos->long_name); | ||
1447 | else | ||
1448 | ret += fprintf(fp, "\n"); | ||
1449 | } | ||
1450 | return ret; | ||
1451 | } | ||
1452 | |||
1431 | int load_kernel(symbol_filter_t filter) | 1453 | int load_kernel(symbol_filter_t filter) |
1432 | { | 1454 | { |
1433 | if (dsos__load_kernel(vmlinux_name, filter, modules) <= 0) | 1455 | if (dsos__load_kernel(vmlinux_name, filter, modules) <= 0) |
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h index 0a34a5493f1b..51c5a4a08133 100644 --- a/tools/perf/util/symbol.h +++ b/tools/perf/util/symbol.h | |||
@@ -80,7 +80,9 @@ int dsos__load_kernel(const char *vmlinux, symbol_filter_t filter, int modules); | |||
80 | struct dso *dsos__findnew(const char *name); | 80 | struct dso *dsos__findnew(const char *name); |
81 | int dso__load(struct dso *self, struct map *map, symbol_filter_t filter); | 81 | int dso__load(struct dso *self, struct map *map, symbol_filter_t filter); |
82 | void dsos__fprintf(FILE *fp); | 82 | void dsos__fprintf(FILE *fp); |
83 | size_t dsos__fprintf_buildid(FILE *fp); | ||
83 | 84 | ||
85 | size_t dso__fprintf_buildid(struct dso *self, FILE *fp); | ||
84 | size_t dso__fprintf(struct dso *self, FILE *fp); | 86 | size_t dso__fprintf(struct dso *self, FILE *fp); |
85 | char dso__symtab_origin(const struct dso *self); | 87 | char dso__symtab_origin(const struct dso *self); |
86 | void dso__set_build_id(struct dso *self, void *build_id); | 88 | void dso__set_build_id(struct dso *self, void *build_id); |