aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/scripting-engines
diff options
context:
space:
mode:
authorFeng Tang <feng.tang@intel.com>2012-08-09 01:46:13 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-08-09 12:26:19 -0400
commit87b6a3ad40ba304ec468b972e979e7e410852476 (patch)
treebcd273478dd47106378b429e85a28d438d82a7e8 /tools/perf/util/scripting-engines
parent0076d546b4f9b5c15121c6959d108a83fe43fa9a (diff)
perf script python: Correct handler check and spelling errors
Correct the checking for handler returned by PyDict_GetItemString(), also fix some spelling error and remove some data code in event_analyzing_sample.py, as suggested by Namhyung Kim. v2: restore back the wrongly removed trace_unhandled() func Signed-off-by: Feng Tang <feng.tang@intel.com> Acked-by: Namhyung Kim <namhyung@kernel.org> Cc: Andi Kleen <andi@firstfloor.org> Cc: David Ahern <dsahern@gmail.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Robert Richter <robert.richter@amd.com> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/r/20120809134613.067104c4@feng-i7 Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/scripting-engines')
-rw-r--r--tools/perf/util/scripting-engines/trace-event-python.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c
index 7e3f57656c55..afba09729183 100644
--- a/tools/perf/util/scripting-engines/trace-event-python.c
+++ b/tools/perf/util/scripting-engines/trace-event-python.c
@@ -343,7 +343,7 @@ static void python_process_general_event(union perf_event *perf_event __unused,
343 struct perf_sample *sample, 343 struct perf_sample *sample,
344 struct perf_evsel *evsel, 344 struct perf_evsel *evsel,
345 struct machine *machine __unused, 345 struct machine *machine __unused,
346 struct addr_location *al __unused) 346 struct addr_location *al)
347{ 347{
348 PyObject *handler, *retval, *t, *dict; 348 PyObject *handler, *retval, *t, *dict;
349 static char handler_name[64]; 349 static char handler_name[64];
@@ -352,7 +352,7 @@ static void python_process_general_event(union perf_event *perf_event __unused,
352 352
353 /* 353 /*
354 * Use the MAX_FIELDS to make the function expandable, though 354 * Use the MAX_FIELDS to make the function expandable, though
355 * currently there is only one itme for the tuple. 355 * currently there is only one item for the tuple.
356 */ 356 */
357 t = PyTuple_New(MAX_FIELDS); 357 t = PyTuple_New(MAX_FIELDS);
358 if (!t) 358 if (!t)
@@ -365,10 +365,8 @@ static void python_process_general_event(union perf_event *perf_event __unused,
365 snprintf(handler_name, sizeof(handler_name), "%s", "process_event"); 365 snprintf(handler_name, sizeof(handler_name), "%s", "process_event");
366 366
367 handler = PyDict_GetItemString(main_dict, handler_name); 367 handler = PyDict_GetItemString(main_dict, handler_name);
368 if (handler && !PyCallable_Check(handler)) { 368 if (!handler || !PyCallable_Check(handler))
369 handler = NULL;
370 goto exit; 369 goto exit;
371 }
372 370
373 PyDict_SetItemString(dict, "ev_name", PyString_FromString(perf_evsel__name(evsel))); 371 PyDict_SetItemString(dict, "ev_name", PyString_FromString(perf_evsel__name(evsel)));
374 PyDict_SetItemString(dict, "attr", PyString_FromStringAndSize( 372 PyDict_SetItemString(dict, "attr", PyString_FromStringAndSize(