aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/symbol.c
diff options
context:
space:
mode:
authorFrederic Weisbecker <fweisbec@gmail.com>2009-11-10 22:51:04 -0500
committerIngo Molnar <mingo@elte.hu>2009-11-11 01:30:18 -0500
commit57f395a7eabb913d3605d7392be5bdb0837c9f3d (patch)
tree141135524cbdb9fa27b48f361443a91b10726f7d /tools/perf/util/symbol.c
parent8671dab9d5b2f0b444b8d09792384dccbfd43d14 (diff)
perf tools: Split up build id saving into fetch and write
We are saving the build id once we stop the profiling. And only after doing that we know if we need to set that feature in the header through the feature bitmap. But if we want a proper feature support in the headers, using a rule of offset/size pairs in sections, we need to know in advance how many features we need to set in the headers, so that we can reserve rooms for their section headers. The current state doesn't allow that, as it forces us to first save the build-ids to the file right after the datas instead of planning any structured layout. That's why this splits up the build-ids processing in two parts: one that fetches the build-ids from the Dso objects, and one that saves them into the file. Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp> LKML-Reference: <1257911467-28276-3-git-send-email-fweisbec@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/util/symbol.c')
-rw-r--r--tools/perf/util/symbol.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index a2e95ce1f223..9c286db62003 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -851,6 +851,40 @@ out_close:
851 return err; 851 return err;
852} 852}
853 853
854bool fetch_build_id_table(struct list_head *head)
855{
856 bool have_buildid = false;
857 struct dso *pos;
858
859 list_for_each_entry(pos, &dsos, node) {
860 struct build_id_list *new;
861 struct build_id_event b;
862 size_t len;
863
864 if (filename__read_build_id(pos->long_name,
865 &b.build_id,
866 sizeof(b.build_id)) < 0)
867 continue;
868 have_buildid = true;
869 memset(&b.header, 0, sizeof(b.header));
870 len = strlen(pos->long_name) + 1;
871 len = ALIGN(len, 64);
872 b.header.size = sizeof(b) + len;
873
874 new = malloc(sizeof(*new));
875 if (!new)
876 die("No memory\n");
877
878 memcpy(&new->event, &b, sizeof(b));
879 new->dso_name = pos->long_name;
880 new->len = len;
881
882 list_add_tail(&new->list, head);
883 }
884
885 return have_buildid;
886}
887
854int filename__read_build_id(const char *filename, void *bf, size_t size) 888int filename__read_build_id(const char *filename, void *bf, size_t size)
855{ 889{
856 int fd, err = -1; 890 int fd, err = -1;