lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87zk64wru6.fsf@sejong.aot.lge.com>
Date:	Thu, 09 Aug 2012 14:35:13 +0900
From:	Namhyung Kim <namhyung@...nel.org>
To:	Feng Tang <feng.tang@...el.com>
Cc:	Arnaldo Carvalho de Melo <acme@...radead.org>,
	Ingo Molnar <mingo@...nel.org>, <linux-kernel@...r.kernel.org>,
	Andi Kleen <andi@...stfloor.org>,
	David Ahern <dsahern@...il.com>, Ingo Molnar <mingo@...e.hu>,
	Peter Zijlstra <peterz@...radead.org>,
	Robert Richter <robert.richter@....com>,
	Stephane Eranian <eranian@...gle.com>,
	Arnaldo Carvalho de Melo <acme@...hat.com>
Subject: Re: [PATCH] perf script python: Correct handler check and spelling errors

On Thu, 9 Aug 2012 13:24:01 +0800, Feng Tang wrote:
> From 3332f03c6e8f641e26430a25704c364c2f30d833 Mon Sep 17 00:00:00 2001
> From: Feng Tang <feng.tang@...el.com>
> Date: Thu, 9 Aug 2012 12:50:56 +0800
> Subject: [PATCH] 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.
>
> Signed-off-by: Feng Tang <feng.tang@...el.com>
> ---
[SNIP]
> -
> -def trace_unhandled(event_name, context, event_fields_dict):
> -		print ' '.join(['%s=%s'%(k,str(v))for k,v in sorted(event_fields_dict.items())])

I guess we need to have the trace_unhandled as a safety net since it can
be called from the scripting-engine?

Thanks,
Namhyung


> -
> -def print_header(event_name, cpu, secs, nsecs, pid, comm):
> -	print "%-20s %5u %05u.%09u %8u %-20s " % \
> -	(event_name, cpu, secs, nsecs, pid, comm),
> diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c
> index 7e3f576..afba097 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,
>  					 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(
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ