diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-08-07 22:50:21 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-08-07 22:50:21 -0400 |
commit | 9782243353ec135327a80c76c63464e592949cd1 (patch) | |
tree | 74e7269019ba3d7cb63b8fb9bd933fdc41c070d7 /tools/perf/util | |
parent | 7f7f8d0bea5d6bb985f4ae84ca3daff34802fd32 (diff) |
perf script: Stop using pevent directly
We can get all that is needed using just event_format, that is available
via evsel->tp_format now.
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
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-2hsr1686epa9f0vx4yg7z2zj@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util')
-rw-r--r-- | tools/perf/util/scripting-engines/trace-event-perl.c | 14 | ||||
-rw-r--r-- | tools/perf/util/scripting-engines/trace-event-python.c | 5 | ||||
-rw-r--r-- | tools/perf/util/trace-event-parse.c | 4 | ||||
-rw-r--r-- | tools/perf/util/trace-event-scripting.c | 1 | ||||
-rw-r--r-- | tools/perf/util/trace-event.h | 3 |
5 files changed, 11 insertions, 16 deletions
diff --git a/tools/perf/util/scripting-engines/trace-event-perl.c b/tools/perf/util/scripting-engines/trace-event-perl.c index c26628116593..52580d09d75c 100644 --- a/tools/perf/util/scripting-engines/trace-event-perl.c +++ b/tools/perf/util/scripting-engines/trace-event-perl.c | |||
@@ -258,7 +258,6 @@ static inline struct event_format *find_cache_event(struct perf_evsel *evsel) | |||
258 | } | 258 | } |
259 | 259 | ||
260 | static void perl_process_tracepoint(union perf_event *perf_event __unused, | 260 | static void perl_process_tracepoint(union perf_event *perf_event __unused, |
261 | struct pevent *pevent, | ||
262 | struct perf_sample *sample, | 261 | struct perf_sample *sample, |
263 | struct perf_evsel *evsel, | 262 | struct perf_evsel *evsel, |
264 | struct machine *machine __unused, | 263 | struct machine *machine __unused, |
@@ -284,7 +283,7 @@ static void perl_process_tracepoint(union perf_event *perf_event __unused, | |||
284 | if (!event) | 283 | if (!event) |
285 | die("ug! no event found for type %d", evsel->attr.config); | 284 | die("ug! no event found for type %d", evsel->attr.config); |
286 | 285 | ||
287 | pid = trace_parse_common_pid(pevent, data); | 286 | pid = raw_field_value(event, "common_pid", data); |
288 | 287 | ||
289 | sprintf(handler, "%s::%s", event->system, event->name); | 288 | sprintf(handler, "%s::%s", event->system, event->name); |
290 | 289 | ||
@@ -317,7 +316,7 @@ static void perl_process_tracepoint(union perf_event *perf_event __unused, | |||
317 | offset = field->offset; | 316 | offset = field->offset; |
318 | XPUSHs(sv_2mortal(newSVpv((char *)data + offset, 0))); | 317 | XPUSHs(sv_2mortal(newSVpv((char *)data + offset, 0))); |
319 | } else { /* FIELD_IS_NUMERIC */ | 318 | } else { /* FIELD_IS_NUMERIC */ |
320 | val = read_size(pevent, data + field->offset, | 319 | val = read_size(event, data + field->offset, |
321 | field->size); | 320 | field->size); |
322 | if (field->flags & FIELD_IS_SIGNED) { | 321 | if (field->flags & FIELD_IS_SIGNED) { |
323 | XPUSHs(sv_2mortal(newSViv(val))); | 322 | XPUSHs(sv_2mortal(newSViv(val))); |
@@ -346,9 +345,9 @@ static void perl_process_tracepoint(union perf_event *perf_event __unused, | |||
346 | LEAVE; | 345 | LEAVE; |
347 | } | 346 | } |
348 | 347 | ||
349 | static void perl_process_event_generic(union perf_event *pevent __unused, | 348 | static void perl_process_event_generic(union perf_event *event, |
350 | struct perf_sample *sample, | 349 | struct perf_sample *sample, |
351 | struct perf_evsel *evsel __unused, | 350 | struct perf_evsel *evsel, |
352 | struct machine *machine __unused, | 351 | struct machine *machine __unused, |
353 | struct thread *thread __unused) | 352 | struct thread *thread __unused) |
354 | { | 353 | { |
@@ -360,7 +359,7 @@ static void perl_process_event_generic(union perf_event *pevent __unused, | |||
360 | ENTER; | 359 | ENTER; |
361 | SAVETMPS; | 360 | SAVETMPS; |
362 | PUSHMARK(SP); | 361 | PUSHMARK(SP); |
363 | XPUSHs(sv_2mortal(newSVpvn((const char *)pevent, pevent->header.size))); | 362 | XPUSHs(sv_2mortal(newSVpvn((const char *)event, event->header.size))); |
364 | XPUSHs(sv_2mortal(newSVpvn((const char *)&evsel->attr, sizeof(evsel->attr)))); | 363 | XPUSHs(sv_2mortal(newSVpvn((const char *)&evsel->attr, sizeof(evsel->attr)))); |
365 | XPUSHs(sv_2mortal(newSVpvn((const char *)sample, sizeof(*sample)))); | 364 | XPUSHs(sv_2mortal(newSVpvn((const char *)sample, sizeof(*sample)))); |
366 | XPUSHs(sv_2mortal(newSVpvn((const char *)sample->raw_data, sample->raw_size))); | 365 | XPUSHs(sv_2mortal(newSVpvn((const char *)sample->raw_data, sample->raw_size))); |
@@ -373,13 +372,12 @@ static void perl_process_event_generic(union perf_event *pevent __unused, | |||
373 | } | 372 | } |
374 | 373 | ||
375 | static void perl_process_event(union perf_event *event, | 374 | static void perl_process_event(union perf_event *event, |
376 | struct pevent *pevent, | ||
377 | struct perf_sample *sample, | 375 | struct perf_sample *sample, |
378 | struct perf_evsel *evsel, | 376 | struct perf_evsel *evsel, |
379 | struct machine *machine, | 377 | struct machine *machine, |
380 | struct thread *thread) | 378 | struct thread *thread) |
381 | { | 379 | { |
382 | perl_process_tracepoint(event, pevent, sample, evsel, machine, thread); | 380 | perl_process_tracepoint(event, sample, evsel, machine, thread); |
383 | perl_process_event_generic(event, sample, evsel, machine, thread); | 381 | perl_process_event_generic(event, sample, evsel, machine, thread); |
384 | } | 382 | } |
385 | 383 | ||
diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c index 8006978d8398..df7d33d1de0f 100644 --- a/tools/perf/util/scripting-engines/trace-event-python.c +++ b/tools/perf/util/scripting-engines/trace-event-python.c | |||
@@ -221,7 +221,6 @@ static inline struct event_format *find_cache_event(struct perf_evsel *evsel) | |||
221 | } | 221 | } |
222 | 222 | ||
223 | static void python_process_event(union perf_event *perf_event __unused, | 223 | static void python_process_event(union perf_event *perf_event __unused, |
224 | struct pevent *pevent, | ||
225 | struct perf_sample *sample, | 224 | struct perf_sample *sample, |
226 | struct perf_evsel *evsel, | 225 | struct perf_evsel *evsel, |
227 | struct machine *machine __unused, | 226 | struct machine *machine __unused, |
@@ -248,7 +247,7 @@ static void python_process_event(union perf_event *perf_event __unused, | |||
248 | if (!event) | 247 | if (!event) |
249 | die("ug! no event found for type %d", (int)evsel->attr.config); | 248 | die("ug! no event found for type %d", (int)evsel->attr.config); |
250 | 249 | ||
251 | pid = trace_parse_common_pid(pevent, data); | 250 | pid = raw_field_value(event, "common_pid", data); |
252 | 251 | ||
253 | sprintf(handler_name, "%s__%s", event->system, event->name); | 252 | sprintf(handler_name, "%s__%s", event->system, event->name); |
254 | 253 | ||
@@ -293,7 +292,7 @@ static void python_process_event(union perf_event *perf_event __unused, | |||
293 | offset = field->offset; | 292 | offset = field->offset; |
294 | obj = PyString_FromString((char *)data + offset); | 293 | obj = PyString_FromString((char *)data + offset); |
295 | } else { /* FIELD_IS_NUMERIC */ | 294 | } else { /* FIELD_IS_NUMERIC */ |
296 | val = read_size(pevent, data + field->offset, | 295 | val = read_size(event, data + field->offset, |
297 | field->size); | 296 | field->size); |
298 | if (field->flags & FIELD_IS_SIGNED) { | 297 | if (field->flags & FIELD_IS_SIGNED) { |
299 | if ((long long)val >= LONG_MIN && | 298 | if ((long long)val >= LONG_MIN && |
diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c index 12088348ac02..4cb7f3831f78 100644 --- a/tools/perf/util/trace-event-parse.c +++ b/tools/perf/util/trace-event-parse.c | |||
@@ -162,9 +162,9 @@ int trace_parse_common_pid(struct pevent *pevent, void *data) | |||
162 | return pevent_data_pid(pevent, &record); | 162 | return pevent_data_pid(pevent, &record); |
163 | } | 163 | } |
164 | 164 | ||
165 | unsigned long long read_size(struct pevent *pevent, void *ptr, int size) | 165 | unsigned long long read_size(struct event_format *event, void *ptr, int size) |
166 | { | 166 | { |
167 | return pevent_read_number(pevent, ptr, size); | 167 | return pevent_read_number(event->pevent, ptr, size); |
168 | } | 168 | } |
169 | 169 | ||
170 | void event_format__print(struct event_format *event, | 170 | void event_format__print(struct event_format *event, |
diff --git a/tools/perf/util/trace-event-scripting.c b/tools/perf/util/trace-event-scripting.c index 474aa7a7df43..aceb8eea15fc 100644 --- a/tools/perf/util/trace-event-scripting.c +++ b/tools/perf/util/trace-event-scripting.c | |||
@@ -36,7 +36,6 @@ static int stop_script_unsupported(void) | |||
36 | } | 36 | } |
37 | 37 | ||
38 | static void process_event_unsupported(union perf_event *event __unused, | 38 | static void process_event_unsupported(union perf_event *event __unused, |
39 | struct pevent *pevent __unused, | ||
40 | struct perf_sample *sample __unused, | 39 | struct perf_sample *sample __unused, |
41 | struct perf_evsel *evsel __unused, | 40 | struct perf_evsel *evsel __unused, |
42 | struct machine *machine __unused, | 41 | struct machine *machine __unused, |
diff --git a/tools/perf/util/trace-event.h b/tools/perf/util/trace-event.h index 069d105e0fc0..cee16350cd86 100644 --- a/tools/perf/util/trace-event.h +++ b/tools/perf/util/trace-event.h | |||
@@ -58,7 +58,7 @@ int trace_parse_common_pid(struct pevent *pevent, void *data); | |||
58 | 58 | ||
59 | struct event_format *trace_find_next_event(struct pevent *pevent, | 59 | struct event_format *trace_find_next_event(struct pevent *pevent, |
60 | struct event_format *event); | 60 | struct event_format *event); |
61 | unsigned long long read_size(struct pevent *pevent, void *ptr, int size); | 61 | unsigned long long read_size(struct event_format *event, void *ptr, int size); |
62 | unsigned long long eval_flag(const char *flag); | 62 | unsigned long long eval_flag(const char *flag); |
63 | 63 | ||
64 | struct pevent_record *trace_read_data(struct pevent *pevent, int cpu); | 64 | struct pevent_record *trace_read_data(struct pevent *pevent, int cpu); |
@@ -81,7 +81,6 @@ struct scripting_ops { | |||
81 | int (*start_script) (const char *script, int argc, const char **argv); | 81 | int (*start_script) (const char *script, int argc, const char **argv); |
82 | int (*stop_script) (void); | 82 | int (*stop_script) (void); |
83 | void (*process_event) (union perf_event *event, | 83 | void (*process_event) (union perf_event *event, |
84 | struct pevent *pevent, | ||
85 | struct perf_sample *sample, | 84 | struct perf_sample *sample, |
86 | struct perf_evsel *evsel, | 85 | struct perf_evsel *evsel, |
87 | struct machine *machine, | 86 | struct machine *machine, |