diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2009-11-18 17:20:51 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-11-19 02:28:12 -0500 |
commit | e30a3d12ddf04add3268bfceb0e57ffe47f254c6 (patch) | |
tree | 421a5726e0f7f87fff772efd7a83ce15c82ba859 /tools/perf/util/symbol.c | |
parent | d3379ab9050e5522da2aac53d413651fc06be562 (diff) |
perf symbols: Kill struct build_id_list and die() another day
No need for this struct and its allocations, we can just use the
->build_id member we already have in struct dso, then ask for it
to be read, and later traverse the dsos list, writing the
buildid table to the perf.data file.
As a bonus, one more die() function got killed.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
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>
LKML-Reference: <1258582853-8579-2-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/util/symbol.c')
-rw-r--r-- | tools/perf/util/symbol.c | 37 |
1 files changed, 9 insertions, 28 deletions
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 594f36a1da8f..946ec319568b 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c | |||
@@ -883,38 +883,19 @@ out_close: | |||
883 | return err; | 883 | return err; |
884 | } | 884 | } |
885 | 885 | ||
886 | bool fetch_build_id_table(struct list_head *head) | 886 | bool dsos__read_build_ids(void) |
887 | { | 887 | { |
888 | bool have_buildid = false; | 888 | bool have_build_id = false; |
889 | struct dso *pos; | 889 | struct dso *pos; |
890 | 890 | ||
891 | list_for_each_entry(pos, &dsos, node) { | 891 | list_for_each_entry(pos, &dsos, node) |
892 | struct build_id_list *new; | 892 | if (filename__read_build_id(pos->long_name, pos->build_id, |
893 | struct build_id_event b; | 893 | sizeof(pos->build_id)) > 0) { |
894 | size_t len; | 894 | have_build_id = true; |
895 | 895 | pos->has_build_id = true; | |
896 | if (filename__read_build_id(pos->long_name, | 896 | } |
897 | &b.build_id, | ||
898 | sizeof(b.build_id)) < 0) | ||
899 | continue; | ||
900 | have_buildid = true; | ||
901 | memset(&b.header, 0, sizeof(b.header)); | ||
902 | len = pos->long_name_len + 1; | ||
903 | len = ALIGN(len, 64); | ||
904 | b.header.size = sizeof(b) + len; | ||
905 | |||
906 | new = malloc(sizeof(*new)); | ||
907 | if (!new) | ||
908 | die("No memory\n"); | ||
909 | |||
910 | memcpy(&new->event, &b, sizeof(b)); | ||
911 | new->dso_name = pos->long_name; | ||
912 | new->len = len; | ||
913 | |||
914 | list_add_tail(&new->list, head); | ||
915 | } | ||
916 | 897 | ||
917 | return have_buildid; | 898 | return have_build_id; |
918 | } | 899 | } |
919 | 900 | ||
920 | int filename__read_build_id(const char *filename, void *bf, size_t size) | 901 | int filename__read_build_id(const char *filename, void *bf, size_t size) |