mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-26 16:41:25 +00:00
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>
This commit is contained in:
parent
0076d546b4
commit
87b6a3ad40
3 changed files with 18 additions and 24 deletions
|
@ -343,7 +343,7 @@ static void python_process_general_event(union perf_event *perf_event __unused,
|
|||
struct perf_sample *sample,
|
||||
struct perf_evsel *evsel,
|
||||
struct machine *machine __unused,
|
||||
struct addr_location *al __unused)
|
||||
struct addr_location *al)
|
||||
{
|
||||
PyObject *handler, *retval, *t, *dict;
|
||||
static char handler_name[64];
|
||||
|
@ -352,7 +352,7 @@ static void python_process_general_event(union perf_event *perf_event __unused,
|
|||
|
||||
/*
|
||||
* Use the MAX_FIELDS to make the function expandable, though
|
||||
* currently there is only one itme for the tuple.
|
||||
* currently there is only one item for the tuple.
|
||||
*/
|
||||
t = PyTuple_New(MAX_FIELDS);
|
||||
if (!t)
|
||||
|
@ -365,10 +365,8 @@ static void python_process_general_event(union perf_event *perf_event __unused,
|
|||
snprintf(handler_name, sizeof(handler_name), "%s", "process_event");
|
||||
|
||||
handler = PyDict_GetItemString(main_dict, handler_name);
|
||||
if (handler && !PyCallable_Check(handler)) {
|
||||
handler = NULL;
|
||||
if (!handler || !PyCallable_Check(handler))
|
||||
goto exit;
|
||||
}
|
||||
|
||||
PyDict_SetItemString(dict, "ev_name", PyString_FromString(perf_evsel__name(evsel)));
|
||||
PyDict_SetItemString(dict, "attr", PyString_FromStringAndSize(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue