diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-10-17 08:32:49 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-10-17 08:32:49 -0400 |
commit | 214e2ca2b82d335935a861c253fe94c61ad77aad (patch) | |
tree | eee42ff74d10470789d919b8499737ad0e919360 /tools/perf/util/scripting-engines/trace-event-perl.c | |
parent | 1fdead8ad31d3aa833bc37739273fcde89ace93c (diff) | |
parent | ddffeb8c4d0331609ef2581d84de4d763607bd37 (diff) |
Merge tag 'v3.7-rc1' into staging/for_v3.8
Linux 3.7-rc1
* tag 'v3.7-rc1': (9579 commits)
Linux 3.7-rc1
x86, boot: Explicitly include autoconf.h for hostprogs
perf: Fix UAPI fallout
ARM: config: make sure that platforms are ordered by option string
ARM: config: sort select statements alphanumerically
UAPI: (Scripted) Disintegrate include/linux/byteorder
UAPI: (Scripted) Disintegrate include/linux
UAPI: Unexport linux/blk_types.h
UAPI: Unexport part of linux/ppp-comp.h
perf: Handle new rbtree implementation
procfs: don't need a PATH_MAX allocation to hold a string representation of an int
vfs: embed struct filename inside of names_cache allocation if possible
audit: make audit_inode take struct filename
vfs: make path_openat take a struct filename pointer
vfs: turn do_path_lookup into wrapper around struct filename variant
audit: allow audit code to satisfy getname requests from its names_list
vfs: define struct filename and have getname() return it
btrfs: Fix compilation with user namespace support enabled
userns: Fix posix_acl_file_xattr_userns gid conversion
userns: Properly print bluetooth socket uids
...
Diffstat (limited to 'tools/perf/util/scripting-engines/trace-event-perl.c')
-rw-r--r-- | tools/perf/util/scripting-engines/trace-event-perl.c | 50 |
1 files changed, 23 insertions, 27 deletions
diff --git a/tools/perf/util/scripting-engines/trace-event-perl.c b/tools/perf/util/scripting-engines/trace-event-perl.c index 02dfa19a467f..f80605eb1855 100644 --- a/tools/perf/util/scripting-engines/trace-event-perl.c +++ b/tools/perf/util/scripting-engines/trace-event-perl.c | |||
@@ -25,16 +25,16 @@ | |||
25 | #include <ctype.h> | 25 | #include <ctype.h> |
26 | #include <errno.h> | 26 | #include <errno.h> |
27 | 27 | ||
28 | #include "../../perf.h" | ||
29 | #include "../util.h" | 28 | #include "../util.h" |
29 | #include <EXTERN.h> | ||
30 | #include <perl.h> | ||
31 | |||
32 | #include "../../perf.h" | ||
30 | #include "../thread.h" | 33 | #include "../thread.h" |
31 | #include "../event.h" | 34 | #include "../event.h" |
32 | #include "../trace-event.h" | 35 | #include "../trace-event.h" |
33 | #include "../evsel.h" | 36 | #include "../evsel.h" |
34 | 37 | ||
35 | #include <EXTERN.h> | ||
36 | #include <perl.h> | ||
37 | |||
38 | void boot_Perf__Trace__Context(pTHX_ CV *cv); | 38 | void boot_Perf__Trace__Context(pTHX_ CV *cv); |
39 | void boot_DynaLoader(pTHX_ CV *cv); | 39 | void boot_DynaLoader(pTHX_ CV *cv); |
40 | typedef PerlInterpreter * INTERP; | 40 | typedef PerlInterpreter * INTERP; |
@@ -237,16 +237,16 @@ static void define_event_symbols(struct event_format *event, | |||
237 | define_event_symbols(event, ev_name, args->next); | 237 | define_event_symbols(event, ev_name, args->next); |
238 | } | 238 | } |
239 | 239 | ||
240 | static inline | 240 | static inline struct event_format *find_cache_event(struct perf_evsel *evsel) |
241 | struct event_format *find_cache_event(struct pevent *pevent, int type) | ||
242 | { | 241 | { |
243 | static char ev_name[256]; | 242 | static char ev_name[256]; |
244 | struct event_format *event; | 243 | struct event_format *event; |
244 | int type = evsel->attr.config; | ||
245 | 245 | ||
246 | if (events[type]) | 246 | if (events[type]) |
247 | return events[type]; | 247 | return events[type]; |
248 | 248 | ||
249 | events[type] = event = pevent_find_event(pevent, type); | 249 | events[type] = event = evsel->tp_format; |
250 | if (!event) | 250 | if (!event) |
251 | return NULL; | 251 | return NULL; |
252 | 252 | ||
@@ -257,23 +257,22 @@ struct event_format *find_cache_event(struct pevent *pevent, int type) | |||
257 | return event; | 257 | return event; |
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 __maybe_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 __maybe_unused, |
265 | struct thread *thread) | 264 | struct addr_location *al) |
266 | { | 265 | { |
267 | struct format_field *field; | 266 | struct format_field *field; |
268 | static char handler[256]; | 267 | static char handler[256]; |
269 | unsigned long long val; | 268 | unsigned long long val; |
270 | unsigned long s, ns; | 269 | unsigned long s, ns; |
271 | struct event_format *event; | 270 | struct event_format *event; |
272 | int type; | ||
273 | int pid; | 271 | int pid; |
274 | int cpu = sample->cpu; | 272 | int cpu = sample->cpu; |
275 | void *data = sample->raw_data; | 273 | void *data = sample->raw_data; |
276 | unsigned long long nsecs = sample->time; | 274 | unsigned long long nsecs = sample->time; |
275 | struct thread *thread = al->thread; | ||
277 | char *comm = thread->comm; | 276 | char *comm = thread->comm; |
278 | 277 | ||
279 | dSP; | 278 | dSP; |
@@ -281,13 +280,11 @@ static void perl_process_tracepoint(union perf_event *perf_event __unused, | |||
281 | if (evsel->attr.type != PERF_TYPE_TRACEPOINT) | 280 | if (evsel->attr.type != PERF_TYPE_TRACEPOINT) |
282 | return; | 281 | return; |
283 | 282 | ||
284 | type = trace_parse_common_type(pevent, data); | 283 | event = find_cache_event(evsel); |
285 | |||
286 | event = find_cache_event(pevent, type); | ||
287 | if (!event) | 284 | if (!event) |
288 | die("ug! no event found for type %d", type); | 285 | die("ug! no event found for type %" PRIu64, evsel->attr.config); |
289 | 286 | ||
290 | pid = trace_parse_common_pid(pevent, data); | 287 | pid = raw_field_value(event, "common_pid", data); |
291 | 288 | ||
292 | sprintf(handler, "%s::%s", event->system, event->name); | 289 | sprintf(handler, "%s::%s", event->system, event->name); |
293 | 290 | ||
@@ -320,7 +317,7 @@ static void perl_process_tracepoint(union perf_event *perf_event __unused, | |||
320 | offset = field->offset; | 317 | offset = field->offset; |
321 | XPUSHs(sv_2mortal(newSVpv((char *)data + offset, 0))); | 318 | XPUSHs(sv_2mortal(newSVpv((char *)data + offset, 0))); |
322 | } else { /* FIELD_IS_NUMERIC */ | 319 | } else { /* FIELD_IS_NUMERIC */ |
323 | val = read_size(pevent, data + field->offset, | 320 | val = read_size(event, data + field->offset, |
324 | field->size); | 321 | field->size); |
325 | if (field->flags & FIELD_IS_SIGNED) { | 322 | if (field->flags & FIELD_IS_SIGNED) { |
326 | XPUSHs(sv_2mortal(newSViv(val))); | 323 | XPUSHs(sv_2mortal(newSViv(val))); |
@@ -349,11 +346,11 @@ static void perl_process_tracepoint(union perf_event *perf_event __unused, | |||
349 | LEAVE; | 346 | LEAVE; |
350 | } | 347 | } |
351 | 348 | ||
352 | static void perl_process_event_generic(union perf_event *pevent __unused, | 349 | static void perl_process_event_generic(union perf_event *event, |
353 | struct perf_sample *sample, | 350 | struct perf_sample *sample, |
354 | struct perf_evsel *evsel __unused, | 351 | struct perf_evsel *evsel, |
355 | struct machine *machine __unused, | 352 | struct machine *machine __maybe_unused, |
356 | struct thread *thread __unused) | 353 | struct addr_location *al __maybe_unused) |
357 | { | 354 | { |
358 | dSP; | 355 | dSP; |
359 | 356 | ||
@@ -363,7 +360,7 @@ static void perl_process_event_generic(union perf_event *pevent __unused, | |||
363 | ENTER; | 360 | ENTER; |
364 | SAVETMPS; | 361 | SAVETMPS; |
365 | PUSHMARK(SP); | 362 | PUSHMARK(SP); |
366 | XPUSHs(sv_2mortal(newSVpvn((const char *)pevent, pevent->header.size))); | 363 | XPUSHs(sv_2mortal(newSVpvn((const char *)event, event->header.size))); |
367 | XPUSHs(sv_2mortal(newSVpvn((const char *)&evsel->attr, sizeof(evsel->attr)))); | 364 | XPUSHs(sv_2mortal(newSVpvn((const char *)&evsel->attr, sizeof(evsel->attr)))); |
368 | XPUSHs(sv_2mortal(newSVpvn((const char *)sample, sizeof(*sample)))); | 365 | XPUSHs(sv_2mortal(newSVpvn((const char *)sample, sizeof(*sample)))); |
369 | XPUSHs(sv_2mortal(newSVpvn((const char *)sample->raw_data, sample->raw_size))); | 366 | XPUSHs(sv_2mortal(newSVpvn((const char *)sample->raw_data, sample->raw_size))); |
@@ -376,14 +373,13 @@ static void perl_process_event_generic(union perf_event *pevent __unused, | |||
376 | } | 373 | } |
377 | 374 | ||
378 | static void perl_process_event(union perf_event *event, | 375 | static void perl_process_event(union perf_event *event, |
379 | struct pevent *pevent, | ||
380 | struct perf_sample *sample, | 376 | struct perf_sample *sample, |
381 | struct perf_evsel *evsel, | 377 | struct perf_evsel *evsel, |
382 | struct machine *machine, | 378 | struct machine *machine, |
383 | struct thread *thread) | 379 | struct addr_location *al) |
384 | { | 380 | { |
385 | perl_process_tracepoint(event, pevent, sample, evsel, machine, thread); | 381 | perl_process_tracepoint(event, sample, evsel, machine, al); |
386 | perl_process_event_generic(event, sample, evsel, machine, thread); | 382 | perl_process_event_generic(event, sample, evsel, machine, al); |
387 | } | 383 | } |
388 | 384 | ||
389 | static void run_start_sub(void) | 385 | static void run_start_sub(void) |