Re: [PATCH 7/8] perf script: Add python support for stat events

From: Jiri Olsa
Date: Wed Dec 23 2015 - 11:04:19 EST


On Wed, Dec 23, 2015 at 10:42:47PM +0900, Namhyung Kim wrote:

SNIP

> > +static void
> > +process_stat(struct perf_evsel *counter, int cpu, int thread, u64 time,
> > + struct perf_counts_values *count)
> > +{
> > + PyObject *handler, *t;
> > + static char handler_name[256];
> > + int n = 0;
> > +
> > + t = PyTuple_New(MAX_FIELDS);
> > + if (!t)
> > + Py_FatalError("couldn't create Python tuple");
> > +
> > + get_handler_name(handler_name, sizeof(handler_name),
> > + counter);
> > +
> > + handler = get_handler(handler_name);
> > + if (!handler) {
> > + pr_debug("can't find python handler %s\n", handler_name);
> > + return;
> > + }
> > +
> > + PyTuple_SetItem(t, n++, PyInt_FromLong(cpu));
> > + PyTuple_SetItem(t, n++, PyInt_FromLong(thread));
> > + PyTuple_SetItem(t, n++, PyLong_FromLong(time));
> > + PyTuple_SetItem(t, n++, PyLong_FromLong(count->val));
> > + PyTuple_SetItem(t, n++, PyLong_FromLong(count->ena));
> > + PyTuple_SetItem(t, n++, PyLong_FromLong(count->run));
>
> What about 32-bit systems? It seems the PyLong_FromLong() takes long
> but the counts are u64.

hum, if it does I think we'll have problems in other
parts of python code.. I'll check, thanks

jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/