diff options
author | David S. Miller <davem@davemloft.net> | 2012-10-02 23:02:10 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-10-02 23:02:10 -0400 |
commit | 954f9ac43b87b44152b8c21163cefd466a87145e (patch) | |
tree | 31c4197f975c66c96976948663e6ce844900b41a /tools/perf/util/scripting-engines/trace-event-perl.c | |
parent | 1b62ca7bf5775bed048032b7e779561e1fe66aa0 (diff) | |
parent | 7fe0b14b725d6d09a1d9e1409bd465cb88b587f9 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux
There's a Niagara 2 memcpy fix in this tree and I have
a Kconfig fix from Dave Jones which requires the sparc-next
changes which went upstream yesterday.
Signed-off-by: David S. Miller <davem@davemloft.net>
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) |