diff options
Diffstat (limited to 'tools/perf/util/scripting-engines/trace-event-python.c')
-rw-r--r-- | tools/perf/util/scripting-engines/trace-event-python.c | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c index 53c20e7fd900..1c419321f707 100644 --- a/tools/perf/util/scripting-engines/trace-event-python.c +++ b/tools/perf/util/scripting-engines/trace-event-python.c | |||
@@ -161,8 +161,7 @@ static void define_event_symbols(struct event_format *event, | |||
161 | zero_flag_atom = 0; | 161 | zero_flag_atom = 0; |
162 | break; | 162 | break; |
163 | case PRINT_FIELD: | 163 | case PRINT_FIELD: |
164 | if (cur_field_name) | 164 | free(cur_field_name); |
165 | free(cur_field_name); | ||
166 | cur_field_name = strdup(args->field.name); | 165 | cur_field_name = strdup(args->field.name); |
167 | break; | 166 | break; |
168 | case PRINT_FLAGS: | 167 | case PRINT_FLAGS: |
@@ -198,6 +197,7 @@ static void define_event_symbols(struct event_format *event, | |||
198 | case PRINT_BSTRING: | 197 | case PRINT_BSTRING: |
199 | case PRINT_DYNAMIC_ARRAY: | 198 | case PRINT_DYNAMIC_ARRAY: |
200 | case PRINT_FUNC: | 199 | case PRINT_FUNC: |
200 | case PRINT_BITMASK: | ||
201 | /* we should warn... */ | 201 | /* we should warn... */ |
202 | return; | 202 | return; |
203 | } | 203 | } |
@@ -231,13 +231,10 @@ static inline struct event_format *find_cache_event(struct perf_evsel *evsel) | |||
231 | return event; | 231 | return event; |
232 | } | 232 | } |
233 | 233 | ||
234 | static void python_process_tracepoint(union perf_event *perf_event | 234 | static void python_process_tracepoint(struct perf_sample *sample, |
235 | __maybe_unused, | 235 | struct perf_evsel *evsel, |
236 | struct perf_sample *sample, | 236 | struct thread *thread, |
237 | struct perf_evsel *evsel, | 237 | struct addr_location *al) |
238 | struct machine *machine __maybe_unused, | ||
239 | struct thread *thread, | ||
240 | struct addr_location *al) | ||
241 | { | 238 | { |
242 | PyObject *handler, *retval, *context, *t, *obj, *dict = NULL; | 239 | PyObject *handler, *retval, *context, *t, *obj, *dict = NULL; |
243 | static char handler_name[256]; | 240 | static char handler_name[256]; |
@@ -351,11 +348,8 @@ static void python_process_tracepoint(union perf_event *perf_event | |||
351 | Py_DECREF(t); | 348 | Py_DECREF(t); |
352 | } | 349 | } |
353 | 350 | ||
354 | static void python_process_general_event(union perf_event *perf_event | 351 | static void python_process_general_event(struct perf_sample *sample, |
355 | __maybe_unused, | ||
356 | struct perf_sample *sample, | ||
357 | struct perf_evsel *evsel, | 352 | struct perf_evsel *evsel, |
358 | struct machine *machine __maybe_unused, | ||
359 | struct thread *thread, | 353 | struct thread *thread, |
360 | struct addr_location *al) | 354 | struct addr_location *al) |
361 | { | 355 | { |
@@ -411,22 +405,19 @@ exit: | |||
411 | Py_DECREF(t); | 405 | Py_DECREF(t); |
412 | } | 406 | } |
413 | 407 | ||
414 | static void python_process_event(union perf_event *perf_event, | 408 | static void python_process_event(union perf_event *event __maybe_unused, |
415 | struct perf_sample *sample, | 409 | struct perf_sample *sample, |
416 | struct perf_evsel *evsel, | 410 | struct perf_evsel *evsel, |
417 | struct machine *machine, | ||
418 | struct thread *thread, | 411 | struct thread *thread, |
419 | struct addr_location *al) | 412 | struct addr_location *al) |
420 | { | 413 | { |
421 | switch (evsel->attr.type) { | 414 | switch (evsel->attr.type) { |
422 | case PERF_TYPE_TRACEPOINT: | 415 | case PERF_TYPE_TRACEPOINT: |
423 | python_process_tracepoint(perf_event, sample, evsel, | 416 | python_process_tracepoint(sample, evsel, thread, al); |
424 | machine, thread, al); | ||
425 | break; | 417 | break; |
426 | /* Reserve for future process_hw/sw/raw APIs */ | 418 | /* Reserve for future process_hw/sw/raw APIs */ |
427 | default: | 419 | default: |
428 | python_process_general_event(perf_event, sample, evsel, | 420 | python_process_general_event(sample, evsel, thread, al); |
429 | machine, thread, al); | ||
430 | } | 421 | } |
431 | } | 422 | } |
432 | 423 | ||
@@ -632,6 +623,7 @@ static int python_generate_script(struct pevent *pevent, const char *outfile) | |||
632 | fprintf(ofp, "%s=", f->name); | 623 | fprintf(ofp, "%s=", f->name); |
633 | if (f->flags & FIELD_IS_STRING || | 624 | if (f->flags & FIELD_IS_STRING || |
634 | f->flags & FIELD_IS_FLAG || | 625 | f->flags & FIELD_IS_FLAG || |
626 | f->flags & FIELD_IS_ARRAY || | ||
635 | f->flags & FIELD_IS_SYMBOLIC) | 627 | f->flags & FIELD_IS_SYMBOLIC) |
636 | fprintf(ofp, "%%s"); | 628 | fprintf(ofp, "%%s"); |
637 | else if (f->flags & FIELD_IS_SIGNED) | 629 | else if (f->flags & FIELD_IS_SIGNED) |