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 | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c index 33a632523743..1b85d6055159 100644 --- a/tools/perf/util/scripting-engines/trace-event-python.c +++ b/tools/perf/util/scripting-engines/trace-event-python.c | |||
| @@ -204,9 +204,10 @@ static inline struct event *find_cache_event(int type) | |||
| 204 | return event; | 204 | return event; |
| 205 | } | 205 | } |
| 206 | 206 | ||
| 207 | static void python_process_event(int cpu, void *data, | 207 | static void python_process_event(union perf_event *pevent __unused, |
| 208 | int size __unused, | 208 | struct perf_sample *sample, |
| 209 | unsigned long long nsecs, char *comm) | 209 | struct perf_session *session __unused, |
| 210 | struct thread *thread) | ||
| 210 | { | 211 | { |
| 211 | PyObject *handler, *retval, *context, *t, *obj, *dict = NULL; | 212 | PyObject *handler, *retval, *context, *t, *obj, *dict = NULL; |
| 212 | static char handler_name[256]; | 213 | static char handler_name[256]; |
| @@ -217,6 +218,10 @@ static void python_process_event(int cpu, void *data, | |||
| 217 | unsigned n = 0; | 218 | unsigned n = 0; |
| 218 | int type; | 219 | int type; |
| 219 | int pid; | 220 | int pid; |
| 221 | int cpu = sample->cpu; | ||
| 222 | void *data = sample->raw_data; | ||
| 223 | unsigned long long nsecs = sample->time; | ||
| 224 | char *comm = thread->comm; | ||
| 220 | 225 | ||
| 221 | t = PyTuple_New(MAX_FIELDS); | 226 | t = PyTuple_New(MAX_FIELDS); |
| 222 | if (!t) | 227 | if (!t) |
| @@ -248,8 +253,7 @@ static void python_process_event(int cpu, void *data, | |||
| 248 | context = PyCObject_FromVoidPtr(scripting_context, NULL); | 253 | context = PyCObject_FromVoidPtr(scripting_context, NULL); |
| 249 | 254 | ||
| 250 | PyTuple_SetItem(t, n++, PyString_FromString(handler_name)); | 255 | PyTuple_SetItem(t, n++, PyString_FromString(handler_name)); |
| 251 | PyTuple_SetItem(t, n++, | 256 | PyTuple_SetItem(t, n++, context); |
| 252 | PyCObject_FromVoidPtr(scripting_context, NULL)); | ||
| 253 | 257 | ||
| 254 | if (handler) { | 258 | if (handler) { |
| 255 | PyTuple_SetItem(t, n++, PyInt_FromLong(cpu)); | 259 | PyTuple_SetItem(t, n++, PyInt_FromLong(cpu)); |
| @@ -442,8 +446,8 @@ static int python_generate_script(const char *outfile) | |||
| 442 | fprintf(stderr, "couldn't open %s\n", fname); | 446 | fprintf(stderr, "couldn't open %s\n", fname); |
| 443 | return -1; | 447 | return -1; |
| 444 | } | 448 | } |
| 445 | fprintf(ofp, "# perf trace event handlers, " | 449 | fprintf(ofp, "# perf script event handlers, " |
| 446 | "generated by perf trace -g python\n"); | 450 | "generated by perf script -g python\n"); |
| 447 | 451 | ||
| 448 | fprintf(ofp, "# Licensed under the terms of the GNU GPL" | 452 | fprintf(ofp, "# Licensed under the terms of the GNU GPL" |
| 449 | " License version 2\n\n"); | 453 | " License version 2\n\n"); |
