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/scripting-engines | |
| 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/scripting-engines')
| -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 |
2 files changed, 8 insertions, 11 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 && |
