aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/session.h
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2010-05-09 18:57:08 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2010-05-09 20:14:52 -0400
commit1f626bc36847ac8dd192f055aed0f9678a781313 (patch)
treed96b43c56217fb1ec7adaf4a9e12e11a61d0ce44 /tools/perf/util/session.h
parent4cc4945844fe2cf493f1783b6ce938ba1617d5c2 (diff)
perf session: Embed the host machine data on perf_session
We have just one host on a given session, and that is the most common setup right now, so embed a ->host_machine struct machine instance directly in the perf_session class, check if we're looking for it before going to the rb_tree. This also fixes a problem found when we try to process old perf.data files where we didn't have MMAP events for the kernel and modules and thus don't create the kernel maps, do it in event__preprocess_sample if it wasn't already. Reported-by: Ingo Molnar <mingo@elte.hu> Cc: Frédéric Weisbecker <fweisbec@gmail.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Tom Zanussi <tzanussi@gmail.com> Cc: Zhang, Yanmin <yanmin_zhang@linux.intel.com> LKML-Reference: <new-submission> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/session.h')
-rw-r--r--tools/perf/util/session.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/tools/perf/util/session.h b/tools/perf/util/session.h
index f2b2c6a3a49d..eb9f179376a5 100644
--- a/tools/perf/util/session.h
+++ b/tools/perf/util/session.h
@@ -25,6 +25,7 @@ struct perf_session {
25 unsigned long mmap_window; 25 unsigned long mmap_window;
26 struct rb_root threads; 26 struct rb_root threads;
27 struct thread *last_match; 27 struct thread *last_match;
28 struct machine host_machine;
28 struct rb_root machines; 29 struct rb_root machines;
29 struct events_stats events_stats; 30 struct events_stats events_stats;
30 struct rb_root stats_by_id; 31 struct rb_root stats_by_id;
@@ -107,18 +108,22 @@ int perf_session__browse_hists(struct rb_root *hists, u64 nr_hists,
107static inline 108static inline
108struct machine *perf_session__find_host_machine(struct perf_session *self) 109struct machine *perf_session__find_host_machine(struct perf_session *self)
109{ 110{
110 return machines__find_host(&self->machines); 111 return &self->host_machine;
111} 112}
112 113
113static inline 114static inline
114struct machine *perf_session__find_machine(struct perf_session *self, pid_t pid) 115struct machine *perf_session__find_machine(struct perf_session *self, pid_t pid)
115{ 116{
117 if (pid == HOST_KERNEL_ID)
118 return &self->host_machine;
116 return machines__find(&self->machines, pid); 119 return machines__find(&self->machines, pid);
117} 120}
118 121
119static inline 122static inline
120struct machine *perf_session__findnew_machine(struct perf_session *self, pid_t pid) 123struct machine *perf_session__findnew_machine(struct perf_session *self, pid_t pid)
121{ 124{
125 if (pid == HOST_KERNEL_ID)
126 return &self->host_machine;
122 return machines__findnew(&self->machines, pid); 127 return machines__findnew(&self->machines, pid);
123} 128}
124 129
@@ -126,14 +131,11 @@ static inline
126void perf_session__process_machines(struct perf_session *self, 131void perf_session__process_machines(struct perf_session *self,
127 machine__process_t process) 132 machine__process_t process)
128{ 133{
134 process(&self->host_machine, self);
129 return machines__process(&self->machines, process, self); 135 return machines__process(&self->machines, process, self);
130} 136}
131 137
132static inline 138size_t perf_session__fprintf_dsos(struct perf_session *self, FILE *fp);
133size_t perf_session__fprintf_dsos(struct perf_session *self, FILE *fp)
134{
135 return machines__fprintf_dsos(&self->machines, fp);
136}
137 139
138static inline 140static inline
139size_t perf_session__fprintf_dsos_buildid(struct perf_session *self, FILE *fp, 141size_t perf_session__fprintf_dsos_buildid(struct perf_session *self, FILE *fp,