aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/session.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2009-12-13 16:50:29 -0500
committerIngo Molnar <mingo@elte.hu>2009-12-14 10:57:17 -0500
commit4aa65636411ccb12f006a6ad593930655c445ff6 (patch)
tree0f494705a2a7631070a5372bb53f873684b001c2 /tools/perf/util/session.c
parentb3165f414416a717f72a376720564012af5a2e01 (diff)
perf session: Move kmaps to perf_session
There is still some more work to do to disentangle map creation from DSO loading, but this happens only for the kernel, and for the early adopters of perf diff, where this disentanglement matters most, we'll be testing different kernels, so no problem here. Further clarification: right now we create the kernel maps for the various modules and discontiguous kernel text maps when loading the DSO, we should do it as a two step process, first creating the maps, for multiple mappings with the same DSO store, then doing the dso load just once, for the first hit on one of the maps sharing this DSO backing store. 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: <1260741029-4430-6-git-send-email-acme@infradead.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/util/session.c')
-rw-r--r--tools/perf/util/session.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 09836a537fc5..fe87a2f2e5a5 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -49,7 +49,7 @@ out_close:
49} 49}
50 50
51struct perf_session *perf_session__new(const char *filename, int mode, 51struct perf_session *perf_session__new(const char *filename, int mode,
52 bool force) 52 bool force, struct symbol_conf *conf)
53{ 53{
54 size_t len = filename ? strlen(filename) + 1 : 0; 54 size_t len = filename ? strlen(filename) + 1 : 0;
55 struct perf_session *self = zalloc(sizeof(*self) + len); 55 struct perf_session *self = zalloc(sizeof(*self) + len);
@@ -58,7 +58,7 @@ struct perf_session *perf_session__new(const char *filename, int mode,
58 goto out; 58 goto out;
59 59
60 if (perf_header__init(&self->header) < 0) 60 if (perf_header__init(&self->header) < 0)
61 goto out_delete; 61 goto out_free;
62 62
63 memcpy(self->filename, filename, len); 63 memcpy(self->filename, filename, len);
64 self->threads = RB_ROOT; 64 self->threads = RB_ROOT;
@@ -66,16 +66,21 @@ struct perf_session *perf_session__new(const char *filename, int mode,
66 self->mmap_window = 32; 66 self->mmap_window = 32;
67 self->cwd = NULL; 67 self->cwd = NULL;
68 self->cwdlen = 0; 68 self->cwdlen = 0;
69 map_groups__init(&self->kmaps);
69 70
70 if (mode == O_RDONLY && perf_session__open(self, force) < 0) { 71 if (perf_session__create_kernel_maps(self, conf) < 0)
71 perf_session__delete(self); 72 goto out_delete;
72 self = NULL; 73
73 } 74 if (mode == O_RDONLY && perf_session__open(self, force) < 0)
75 goto out_delete;
74out: 76out:
75 return self; 77 return self;
76out_delete: 78out_free:
77 free(self); 79 free(self);
78 return NULL; 80 return NULL;
81out_delete:
82 perf_session__delete(self);
83 return NULL;
79} 84}
80 85
81void perf_session__delete(struct perf_session *self) 86void perf_session__delete(struct perf_session *self)