aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/session.h
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2011-11-25 05:19:45 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2011-11-28 07:38:56 -0500
commitd20deb64e0490ee9442b5181bc08a62d2cadcb90 (patch)
treeafdb3f6fc9abbce9d0a96b7049d1f8121178a356 /tools/perf/util/session.h
parent7009cc34b964939815160d7de64cf0215cdbf8bb (diff)
perf tools: Pass tool context in the the perf_event_ops functions
So that we don't need to have that many globals. Next steps will remove the 'session' pointer, that in most cases is not needed. Then we can rename perf_event_ops to 'perf_tool' that better describes this class hierarchy. Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-wp4djox7x6w1i2bab1pt4xxp@git.kernel.org 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.h23
1 files changed, 13 insertions, 10 deletions
diff --git a/tools/perf/util/session.h b/tools/perf/util/session.h
index d2f430367713..6de3d1368900 100644
--- a/tools/perf/util/session.h
+++ b/tools/perf/util/session.h
@@ -56,16 +56,18 @@ struct perf_session {
56struct perf_evsel; 56struct perf_evsel;
57struct perf_event_ops; 57struct perf_event_ops;
58 58
59typedef int (*event_sample)(union perf_event *event, struct perf_sample *sample, 59typedef int (*event_sample)(struct perf_event_ops *ops,
60 union perf_event *event, struct perf_sample *sample,
60 struct perf_evsel *evsel, struct perf_session *session); 61 struct perf_evsel *evsel, struct perf_session *session);
61typedef int (*event_op)(union perf_event *self, struct perf_sample *sample, 62typedef int (*event_op)(struct perf_event_ops *ops, union perf_event *event,
63 struct perf_sample *sample,
62 struct perf_session *session); 64 struct perf_session *session);
63typedef int (*event_synth_op)(union perf_event *self, 65typedef int (*event_synth_op)(union perf_event *self,
64 struct perf_session *session); 66 struct perf_session *session);
65typedef int (*event_attr_op)(union perf_event *event, 67typedef int (*event_attr_op)(union perf_event *event,
66 struct perf_evlist **pevlist); 68 struct perf_evlist **pevlist);
67typedef int (*event_op2)(union perf_event *self, struct perf_session *session, 69typedef int (*event_op2)(struct perf_event_ops *ops, union perf_event *event,
68 struct perf_event_ops *ops); 70 struct perf_session *session);
69 71
70struct perf_event_ops { 72struct perf_event_ops {
71 event_sample sample; 73 event_sample sample;
@@ -78,10 +80,10 @@ struct perf_event_ops {
78 throttle, 80 throttle,
79 unthrottle; 81 unthrottle;
80 event_attr_op attr; 82 event_attr_op attr;
81 event_synth_op event_type, 83 event_synth_op tracing_data;
82 tracing_data, 84 event_op2 event_type,
83 build_id; 85 build_id,
84 event_op2 finished_round; 86 finished_round;
85 bool ordered_samples; 87 bool ordered_samples;
86 bool ordering_requires_timestamps; 88 bool ordering_requires_timestamps;
87}; 89};
@@ -142,10 +144,11 @@ struct machine *perf_session__findnew_machine(struct perf_session *self, pid_t p
142 144
143static inline 145static inline
144void perf_session__process_machines(struct perf_session *self, 146void perf_session__process_machines(struct perf_session *self,
147 struct perf_event_ops *ops,
145 machine__process_t process) 148 machine__process_t process)
146{ 149{
147 process(&self->host_machine, self); 150 process(&self->host_machine, ops);
148 return machines__process(&self->machines, process, self); 151 return machines__process(&self->machines, process, ops);
149} 152}
150 153
151size_t perf_session__fprintf_dsos(struct perf_session *self, FILE *fp); 154size_t perf_session__fprintf_dsos(struct perf_session *self, FILE *fp);