aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/scripting-engines/trace-event-perl.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/scripting-engines/trace-event-perl.c')
-rw-r--r--tools/perf/util/scripting-engines/trace-event-perl.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/tools/perf/util/scripting-engines/trace-event-perl.c b/tools/perf/util/scripting-engines/trace-event-perl.c
index 4c1b3d72a1d2..b3620fe12763 100644
--- a/tools/perf/util/scripting-engines/trace-event-perl.c
+++ b/tools/perf/util/scripting-engines/trace-event-perl.c
@@ -233,7 +233,8 @@ static void define_event_symbols(struct event_format *event,
233 define_event_symbols(event, ev_name, args->next); 233 define_event_symbols(event, ev_name, args->next);
234} 234}
235 235
236static inline struct event_format *find_cache_event(int type) 236static inline
237struct event_format *find_cache_event(struct pevent *pevent, int type)
237{ 238{
238 static char ev_name[256]; 239 static char ev_name[256];
239 struct event_format *event; 240 struct event_format *event;
@@ -241,7 +242,7 @@ static inline struct event_format *find_cache_event(int type)
241 if (events[type]) 242 if (events[type])
242 return events[type]; 243 return events[type];
243 244
244 events[type] = event = trace_find_event(type); 245 events[type] = event = pevent_find_event(pevent, type);
245 if (!event) 246 if (!event)
246 return NULL; 247 return NULL;
247 248
@@ -252,7 +253,8 @@ static inline struct event_format *find_cache_event(int type)
252 return event; 253 return event;
253} 254}
254 255
255static void perl_process_tracepoint(union perf_event *pevent __unused, 256static void perl_process_tracepoint(union perf_event *perf_event __unused,
257 struct pevent *pevent,
256 struct perf_sample *sample, 258 struct perf_sample *sample,
257 struct perf_evsel *evsel, 259 struct perf_evsel *evsel,
258 struct machine *machine __unused, 260 struct machine *machine __unused,
@@ -275,13 +277,13 @@ static void perl_process_tracepoint(union perf_event *pevent __unused,
275 if (evsel->attr.type != PERF_TYPE_TRACEPOINT) 277 if (evsel->attr.type != PERF_TYPE_TRACEPOINT)
276 return; 278 return;
277 279
278 type = trace_parse_common_type(data); 280 type = trace_parse_common_type(pevent, data);
279 281
280 event = find_cache_event(type); 282 event = find_cache_event(pevent, type);
281 if (!event) 283 if (!event)
282 die("ug! no event found for type %d", type); 284 die("ug! no event found for type %d", type);
283 285
284 pid = trace_parse_common_pid(data); 286 pid = trace_parse_common_pid(pevent, data);
285 287
286 sprintf(handler, "%s::%s", event->system, event->name); 288 sprintf(handler, "%s::%s", event->system, event->name);
287 289
@@ -314,7 +316,8 @@ static void perl_process_tracepoint(union perf_event *pevent __unused,
314 offset = field->offset; 316 offset = field->offset;
315 XPUSHs(sv_2mortal(newSVpv((char *)data + offset, 0))); 317 XPUSHs(sv_2mortal(newSVpv((char *)data + offset, 0)));
316 } else { /* FIELD_IS_NUMERIC */ 318 } else { /* FIELD_IS_NUMERIC */
317 val = read_size(data + field->offset, field->size); 319 val = read_size(pevent, data + field->offset,
320 field->size);
318 if (field->flags & FIELD_IS_SIGNED) { 321 if (field->flags & FIELD_IS_SIGNED) {
319 XPUSHs(sv_2mortal(newSViv(val))); 322 XPUSHs(sv_2mortal(newSViv(val)));
320 } else { 323 } else {
@@ -368,14 +371,15 @@ static void perl_process_event_generic(union perf_event *pevent __unused,
368 LEAVE; 371 LEAVE;
369} 372}
370 373
371static void perl_process_event(union perf_event *pevent, 374static void perl_process_event(union perf_event *event,
375 struct pevent *pevent,
372 struct perf_sample *sample, 376 struct perf_sample *sample,
373 struct perf_evsel *evsel, 377 struct perf_evsel *evsel,
374 struct machine *machine, 378 struct machine *machine,
375 struct thread *thread) 379 struct thread *thread)
376{ 380{
377 perl_process_tracepoint(pevent, sample, evsel, machine, thread); 381 perl_process_tracepoint(event, pevent, sample, evsel, machine, thread);
378 perl_process_event_generic(pevent, sample, evsel, machine, thread); 382 perl_process_event_generic(event, sample, evsel, machine, thread);
379} 383}
380 384
381static void run_start_sub(void) 385static void run_start_sub(void)
@@ -448,7 +452,7 @@ static int perl_stop_script(void)
448 return 0; 452 return 0;
449} 453}
450 454
451static int perl_generate_script(const char *outfile) 455static int perl_generate_script(struct pevent *pevent, const char *outfile)
452{ 456{
453 struct event_format *event = NULL; 457 struct event_format *event = NULL;
454 struct format_field *f; 458 struct format_field *f;
@@ -495,7 +499,7 @@ static int perl_generate_script(const char *outfile)
495 fprintf(ofp, "sub trace_begin\n{\n\t# optional\n}\n\n"); 499 fprintf(ofp, "sub trace_begin\n{\n\t# optional\n}\n\n");
496 fprintf(ofp, "sub trace_end\n{\n\t# optional\n}\n\n"); 500 fprintf(ofp, "sub trace_end\n{\n\t# optional\n}\n\n");
497 501
498 while ((event = trace_find_next_event(event))) { 502 while ((event = trace_find_next_event(pevent, event))) {
499 fprintf(ofp, "sub %s::%s\n{\n", event->system, event->name); 503 fprintf(ofp, "sub %s::%s\n{\n", event->system, event->name);
500 fprintf(ofp, "\tmy ("); 504 fprintf(ofp, "\tmy (");
501 505