Re: perf script: Question: Python trace processing script contains the tid of the process in the common_pid attribute

From: Arnaldo Carvalho de Melo
Date: Fri Jul 07 2017 - 11:18:30 EST


Em Wed, Jul 05, 2017 at 04:51:26PM -0700, Arun Kalyanasundaram escreveu:
> Arnaldo:
> So, I think what you are suggesting is, we should check the signature
> of the hook to determine if it has an additional attribute and only
> then should we provide the dict. May be something like this:
>
> PyObject* custom_dict = PyObject_GetAttrString(handler, "other_fields_dict");
> if (custom_dict)
> //Add dict to PyTuple
>
> Do you think this would be a better approach?

I think that we should provide as much as possible the common info about
a sample at all the sample processing routines, be it the initial,
tracepoint specific one, the one for non-tracepoint samples and the
trace_unhandled one.

So scripts not using this optional argument will work with older
versions of the perf tool as well as with new ones that support it.

One could say that to use a script that wants this optional argument, a
new enough version of the tool is required.

So yeah, I think this is a better approach. The details of how to best
do this method signature signing need to be figured out, of course.

Thanks for working on this!

- Arnaldo