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 | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c index 0c815a40a6e8..ace2484985cb 100644 --- a/tools/perf/util/scripting-engines/trace-event-python.c +++ b/tools/perf/util/scripting-engines/trace-event-python.c | |||
@@ -44,10 +44,10 @@ | |||
44 | 44 | ||
45 | PyMODINIT_FUNC initperf_trace_context(void); | 45 | PyMODINIT_FUNC initperf_trace_context(void); |
46 | 46 | ||
47 | #define FTRACE_MAX_EVENT \ | 47 | #define TRACE_EVENT_TYPE_MAX \ |
48 | ((1 << (sizeof(unsigned short) * 8)) - 1) | 48 | ((1 << (sizeof(unsigned short) * 8)) - 1) |
49 | 49 | ||
50 | static DECLARE_BITMAP(events_defined, FTRACE_MAX_EVENT); | 50 | static DECLARE_BITMAP(events_defined, TRACE_EVENT_TYPE_MAX); |
51 | 51 | ||
52 | #define MAX_FIELDS 64 | 52 | #define MAX_FIELDS 64 |
53 | #define N_COMMON_FIELDS 7 | 53 | #define N_COMMON_FIELDS 7 |
@@ -231,6 +231,11 @@ static void define_event_symbols(struct event_format *event, | |||
231 | define_event_symbols(event, ev_name, args->hex.field); | 231 | define_event_symbols(event, ev_name, args->hex.field); |
232 | define_event_symbols(event, ev_name, args->hex.size); | 232 | define_event_symbols(event, ev_name, args->hex.size); |
233 | break; | 233 | break; |
234 | case PRINT_INT_ARRAY: | ||
235 | define_event_symbols(event, ev_name, args->int_array.field); | ||
236 | define_event_symbols(event, ev_name, args->int_array.count); | ||
237 | define_event_symbols(event, ev_name, args->int_array.el_size); | ||
238 | break; | ||
234 | case PRINT_STRING: | 239 | case PRINT_STRING: |
235 | break; | 240 | break; |
236 | case PRINT_TYPE: | 241 | case PRINT_TYPE: |
@@ -376,7 +381,6 @@ exit: | |||
376 | 381 | ||
377 | static void python_process_tracepoint(struct perf_sample *sample, | 382 | static void python_process_tracepoint(struct perf_sample *sample, |
378 | struct perf_evsel *evsel, | 383 | struct perf_evsel *evsel, |
379 | struct thread *thread, | ||
380 | struct addr_location *al) | 384 | struct addr_location *al) |
381 | { | 385 | { |
382 | struct event_format *event = evsel->tp_format; | 386 | struct event_format *event = evsel->tp_format; |
@@ -390,7 +394,7 @@ static void python_process_tracepoint(struct perf_sample *sample, | |||
390 | int cpu = sample->cpu; | 394 | int cpu = sample->cpu; |
391 | void *data = sample->raw_data; | 395 | void *data = sample->raw_data; |
392 | unsigned long long nsecs = sample->time; | 396 | unsigned long long nsecs = sample->time; |
393 | const char *comm = thread__comm_str(thread); | 397 | const char *comm = thread__comm_str(al->thread); |
394 | 398 | ||
395 | t = PyTuple_New(MAX_FIELDS); | 399 | t = PyTuple_New(MAX_FIELDS); |
396 | if (!t) | 400 | if (!t) |
@@ -675,7 +679,7 @@ static int python_export_sample(struct db_export *dbe, | |||
675 | tuple_set_u64(t, 0, es->db_id); | 679 | tuple_set_u64(t, 0, es->db_id); |
676 | tuple_set_u64(t, 1, es->evsel->db_id); | 680 | tuple_set_u64(t, 1, es->evsel->db_id); |
677 | tuple_set_u64(t, 2, es->al->machine->db_id); | 681 | tuple_set_u64(t, 2, es->al->machine->db_id); |
678 | tuple_set_u64(t, 3, es->thread->db_id); | 682 | tuple_set_u64(t, 3, es->al->thread->db_id); |
679 | tuple_set_u64(t, 4, es->comm_db_id); | 683 | tuple_set_u64(t, 4, es->comm_db_id); |
680 | tuple_set_u64(t, 5, es->dso_db_id); | 684 | tuple_set_u64(t, 5, es->dso_db_id); |
681 | tuple_set_u64(t, 6, es->sym_db_id); | 685 | tuple_set_u64(t, 6, es->sym_db_id); |
@@ -761,7 +765,6 @@ static int python_process_call_return(struct call_return *cr, void *data) | |||
761 | 765 | ||
762 | static void python_process_general_event(struct perf_sample *sample, | 766 | static void python_process_general_event(struct perf_sample *sample, |
763 | struct perf_evsel *evsel, | 767 | struct perf_evsel *evsel, |
764 | struct thread *thread, | ||
765 | struct addr_location *al) | 768 | struct addr_location *al) |
766 | { | 769 | { |
767 | PyObject *handler, *t, *dict, *callchain, *dict_sample; | 770 | PyObject *handler, *t, *dict, *callchain, *dict_sample; |
@@ -811,7 +814,7 @@ static void python_process_general_event(struct perf_sample *sample, | |||
811 | pydict_set_item_string_decref(dict, "raw_buf", PyString_FromStringAndSize( | 814 | pydict_set_item_string_decref(dict, "raw_buf", PyString_FromStringAndSize( |
812 | (const char *)sample->raw_data, sample->raw_size)); | 815 | (const char *)sample->raw_data, sample->raw_size)); |
813 | pydict_set_item_string_decref(dict, "comm", | 816 | pydict_set_item_string_decref(dict, "comm", |
814 | PyString_FromString(thread__comm_str(thread))); | 817 | PyString_FromString(thread__comm_str(al->thread))); |
815 | if (al->map) { | 818 | if (al->map) { |
816 | pydict_set_item_string_decref(dict, "dso", | 819 | pydict_set_item_string_decref(dict, "dso", |
817 | PyString_FromString(al->map->dso->name)); | 820 | PyString_FromString(al->map->dso->name)); |
@@ -838,22 +841,20 @@ exit: | |||
838 | static void python_process_event(union perf_event *event, | 841 | static void python_process_event(union perf_event *event, |
839 | struct perf_sample *sample, | 842 | struct perf_sample *sample, |
840 | struct perf_evsel *evsel, | 843 | struct perf_evsel *evsel, |
841 | struct thread *thread, | ||
842 | struct addr_location *al) | 844 | struct addr_location *al) |
843 | { | 845 | { |
844 | struct tables *tables = &tables_global; | 846 | struct tables *tables = &tables_global; |
845 | 847 | ||
846 | switch (evsel->attr.type) { | 848 | switch (evsel->attr.type) { |
847 | case PERF_TYPE_TRACEPOINT: | 849 | case PERF_TYPE_TRACEPOINT: |
848 | python_process_tracepoint(sample, evsel, thread, al); | 850 | python_process_tracepoint(sample, evsel, al); |
849 | break; | 851 | break; |
850 | /* Reserve for future process_hw/sw/raw APIs */ | 852 | /* Reserve for future process_hw/sw/raw APIs */ |
851 | default: | 853 | default: |
852 | if (tables->db_export_mode) | 854 | if (tables->db_export_mode) |
853 | db_export__sample(&tables->dbe, event, sample, evsel, | 855 | db_export__sample(&tables->dbe, event, sample, evsel, al); |
854 | thread, al); | ||
855 | else | 856 | else |
856 | python_process_general_event(sample, evsel, thread, al); | 857 | python_process_general_event(sample, evsel, al); |
857 | } | 858 | } |
858 | } | 859 | } |
859 | 860 | ||