aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2009-12-14 11:23:00 -0500
committerIngo Molnar <mingo@elte.hu>2009-12-14 11:34:56 -0500
commitc019879bcc5692ec9267c1cedad91f1794d0b693 (patch)
treeec499400b1ee0b1d93e961cc67b9dead9cd8c9a9 /tools/perf/util
parenta328626b61aeda1a7d00a80c475c76ca1b815e0d (diff)
perf session: Adopt the sample_type variable
All tools had copies, and perf diff would have to specify a sample_type_check method just for copying it. 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: <1260807780-19377-2-git-send-email-acme@infradead.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/util')
-rw-r--r--tools/perf/util/data_map.c6
-rw-r--r--tools/perf/util/session.h4
2 files changed, 4 insertions, 6 deletions
diff --git a/tools/perf/util/data_map.c b/tools/perf/util/data_map.c
index 08c4cf5e66b..b557b836de3 100644
--- a/tools/perf/util/data_map.c
+++ b/tools/perf/util/data_map.c
@@ -144,7 +144,6 @@ int perf_session__process_events(struct perf_session *self,
144 unsigned long head, shift; 144 unsigned long head, shift;
145 unsigned long offset = 0; 145 unsigned long offset = 0;
146 size_t page_size; 146 size_t page_size;
147 u64 sample_type;
148 event_t *event; 147 event_t *event;
149 uint32_t size; 148 uint32_t size;
150 char *buf; 149 char *buf;
@@ -157,11 +156,10 @@ int perf_session__process_events(struct perf_session *self,
157 page_size = getpagesize(); 156 page_size = getpagesize();
158 157
159 head = self->header.data_offset; 158 head = self->header.data_offset;
160 sample_type = perf_header__sample_type(&self->header); 159 self->sample_type = perf_header__sample_type(&self->header);
161 160
162 err = -EINVAL; 161 err = -EINVAL;
163 if (ops->sample_type_check && 162 if (ops->sample_type_check && ops->sample_type_check(self) < 0)
164 ops->sample_type_check(sample_type, self) < 0)
165 goto out_err; 163 goto out_err;
166 164
167 if (!ops->full_paths) { 165 if (!ops->full_paths) {
diff --git a/tools/perf/util/session.h b/tools/perf/util/session.h
index a8f3a49ca43..4e8a21c5304 100644
--- a/tools/perf/util/session.h
+++ b/tools/perf/util/session.h
@@ -19,6 +19,7 @@ struct perf_session {
19 struct rb_root threads; 19 struct rb_root threads;
20 struct thread *last_match; 20 struct thread *last_match;
21 struct rb_root hists; 21 struct rb_root hists;
22 u64 sample_type;
22 int fd; 23 int fd;
23 int cwdlen; 24 int cwdlen;
24 char *cwd; 25 char *cwd;
@@ -39,8 +40,7 @@ struct perf_event_ops {
39 event_op process_read_event; 40 event_op process_read_event;
40 event_op process_throttle_event; 41 event_op process_throttle_event;
41 event_op process_unthrottle_event; 42 event_op process_unthrottle_event;
42 int (*sample_type_check)(u64 sample_type, 43 int (*sample_type_check)(struct perf_session *session);
43 struct perf_session *session);
44 unsigned long total_unknown; 44 unsigned long total_unknown;
45 bool full_paths; 45 bool full_paths;
46}; 46};