diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-01-29 11:01:45 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-01-29 13:25:37 -0500 |
commit | 8115d60c323dd9931b95221c0a392aeddc1d6ef3 (patch) | |
tree | 13e75d71c5163c78efc9d8ab33988cc6c7be74a1 /tools/perf/builtin-inject.c | |
parent | 8d50e5b4171a69cf48ca94a1e7c14033d0b4771d (diff) |
perf tools: Kill event_t typedef, use 'union perf_event' instead
And move the event_t methods to the perf_event__ too.
No code changes, just namespace consistency.
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-inject.c')
-rw-r--r-- | tools/perf/builtin-inject.c | 82 |
1 files changed, 43 insertions, 39 deletions
diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c index 4c9388ce878c..e29f04ed3396 100644 --- a/tools/perf/builtin-inject.c +++ b/tools/perf/builtin-inject.c | |||
@@ -16,8 +16,8 @@ | |||
16 | static char const *input_name = "-"; | 16 | static char const *input_name = "-"; |
17 | static bool inject_build_ids; | 17 | static bool inject_build_ids; |
18 | 18 | ||
19 | static int event__repipe_synth(event_t *event, | 19 | static int perf_event__repipe_synth(union perf_event *event, |
20 | struct perf_session *session __used) | 20 | struct perf_session *session __used) |
21 | { | 21 | { |
22 | uint32_t size; | 22 | uint32_t size; |
23 | void *buf = event; | 23 | void *buf = event; |
@@ -36,41 +36,44 @@ static int event__repipe_synth(event_t *event, | |||
36 | return 0; | 36 | return 0; |
37 | } | 37 | } |
38 | 38 | ||
39 | static int event__repipe(event_t *event, struct perf_sample *sample __used, | 39 | static int perf_event__repipe(union perf_event *event, |
40 | struct perf_session *session) | 40 | struct perf_sample *sample __used, |
41 | struct perf_session *session) | ||
41 | { | 42 | { |
42 | return event__repipe_synth(event, session); | 43 | return perf_event__repipe_synth(event, session); |
43 | } | 44 | } |
44 | 45 | ||
45 | static int event__repipe_mmap(event_t *self, struct perf_sample *sample, | 46 | static int perf_event__repipe_mmap(union perf_event *event, |
46 | struct perf_session *session) | 47 | struct perf_sample *sample, |
48 | struct perf_session *session) | ||
47 | { | 49 | { |
48 | int err; | 50 | int err; |
49 | 51 | ||
50 | err = event__process_mmap(self, sample, session); | 52 | err = perf_event__process_mmap(event, sample, session); |
51 | event__repipe(self, sample, session); | 53 | perf_event__repipe(event, sample, session); |
52 | 54 | ||
53 | return err; | 55 | return err; |
54 | } | 56 | } |
55 | 57 | ||
56 | static int event__repipe_task(event_t *self, struct perf_sample *sample, | 58 | static int perf_event__repipe_task(union perf_event *event, |
57 | struct perf_session *session) | 59 | struct perf_sample *sample, |
60 | struct perf_session *session) | ||
58 | { | 61 | { |
59 | int err; | 62 | int err; |
60 | 63 | ||
61 | err = event__process_task(self, sample, session); | 64 | err = perf_event__process_task(event, sample, session); |
62 | event__repipe(self, sample, session); | 65 | perf_event__repipe(event, sample, session); |
63 | 66 | ||
64 | return err; | 67 | return err; |
65 | } | 68 | } |
66 | 69 | ||
67 | static int event__repipe_tracing_data(event_t *self, | 70 | static int perf_event__repipe_tracing_data(union perf_event *event, |
68 | struct perf_session *session) | 71 | struct perf_session *session) |
69 | { | 72 | { |
70 | int err; | 73 | int err; |
71 | 74 | ||
72 | event__repipe_synth(self, session); | 75 | perf_event__repipe_synth(event, session); |
73 | err = event__process_tracing_data(self, session); | 76 | err = perf_event__process_tracing_data(event, session); |
74 | 77 | ||
75 | return err; | 78 | return err; |
76 | } | 79 | } |
@@ -109,8 +112,8 @@ static int dso__inject_build_id(struct dso *self, struct perf_session *session) | |||
109 | if (self->kernel) | 112 | if (self->kernel) |
110 | misc = PERF_RECORD_MISC_KERNEL; | 113 | misc = PERF_RECORD_MISC_KERNEL; |
111 | 114 | ||
112 | err = event__synthesize_build_id(self, misc, event__repipe, | 115 | err = perf_event__synthesize_build_id(self, misc, perf_event__repipe, |
113 | machine, session); | 116 | machine, session); |
114 | if (err) { | 117 | if (err) { |
115 | pr_err("Can't synthesize build_id event for %s\n", self->long_name); | 118 | pr_err("Can't synthesize build_id event for %s\n", self->long_name); |
116 | return -1; | 119 | return -1; |
@@ -119,8 +122,9 @@ static int dso__inject_build_id(struct dso *self, struct perf_session *session) | |||
119 | return 0; | 122 | return 0; |
120 | } | 123 | } |
121 | 124 | ||
122 | static int event__inject_buildid(event_t *event, struct perf_sample *sample, | 125 | static int perf_event__inject_buildid(union perf_event *event, |
123 | struct perf_session *session) | 126 | struct perf_sample *sample, |
127 | struct perf_session *session) | ||
124 | { | 128 | { |
125 | struct addr_location al; | 129 | struct addr_location al; |
126 | struct thread *thread; | 130 | struct thread *thread; |
@@ -155,24 +159,24 @@ static int event__inject_buildid(event_t *event, struct perf_sample *sample, | |||
155 | } | 159 | } |
156 | 160 | ||
157 | repipe: | 161 | repipe: |
158 | event__repipe(event, sample, session); | 162 | perf_event__repipe(event, sample, session); |
159 | return 0; | 163 | return 0; |
160 | } | 164 | } |
161 | 165 | ||
162 | struct perf_event_ops inject_ops = { | 166 | struct perf_event_ops inject_ops = { |
163 | .sample = event__repipe, | 167 | .sample = perf_event__repipe, |
164 | .mmap = event__repipe, | 168 | .mmap = perf_event__repipe, |
165 | .comm = event__repipe, | 169 | .comm = perf_event__repipe, |
166 | .fork = event__repipe, | 170 | .fork = perf_event__repipe, |
167 | .exit = event__repipe, | 171 | .exit = perf_event__repipe, |
168 | .lost = event__repipe, | 172 | .lost = perf_event__repipe, |
169 | .read = event__repipe, | 173 | .read = perf_event__repipe, |
170 | .throttle = event__repipe, | 174 | .throttle = perf_event__repipe, |
171 | .unthrottle = event__repipe, | 175 | .unthrottle = perf_event__repipe, |
172 | .attr = event__repipe_synth, | 176 | .attr = perf_event__repipe_synth, |
173 | .event_type = event__repipe_synth, | 177 | .event_type = perf_event__repipe_synth, |
174 | .tracing_data = event__repipe_synth, | 178 | .tracing_data = perf_event__repipe_synth, |
175 | .build_id = event__repipe_synth, | 179 | .build_id = perf_event__repipe_synth, |
176 | }; | 180 | }; |
177 | 181 | ||
178 | extern volatile int session_done; | 182 | extern volatile int session_done; |
@@ -190,10 +194,10 @@ static int __cmd_inject(void) | |||
190 | signal(SIGINT, sig_handler); | 194 | signal(SIGINT, sig_handler); |
191 | 195 | ||
192 | if (inject_build_ids) { | 196 | if (inject_build_ids) { |
193 | inject_ops.sample = event__inject_buildid; | 197 | inject_ops.sample = perf_event__inject_buildid; |
194 | inject_ops.mmap = event__repipe_mmap; | 198 | inject_ops.mmap = perf_event__repipe_mmap; |
195 | inject_ops.fork = event__repipe_task; | 199 | inject_ops.fork = perf_event__repipe_task; |
196 | inject_ops.tracing_data = event__repipe_tracing_data; | 200 | inject_ops.tracing_data = perf_event__repipe_tracing_data; |
197 | } | 201 | } |
198 | 202 | ||
199 | session = perf_session__new(input_name, O_RDONLY, false, true, &inject_ops); | 203 | session = perf_session__new(input_name, O_RDONLY, false, true, &inject_ops); |