[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180530174346.GE30764@tassilo.jf.intel.com>
Date: Wed, 30 May 2018 10:43:46 -0700
From: Andi Kleen <ak@...ux.intel.com>
To: Jin Yao <yao.jin@...ux.intel.com>
Cc: acme@...nel.org, jolsa@...nel.org, peterz@...radead.org,
mingo@...hat.com, alexander.shishkin@...ux.intel.com,
Linux-kernel@...r.kernel.org, kan.liang@...el.com,
yao.jin@...el.com
Subject: Re: [PATCH] perf util: Add more PMU fields for perf script python
On Wed, May 30, 2018 at 10:20:45PM +0800, Jin Yao wrote:
> When doing pmu sampling and then running a script with
> perf script -s script.py, the process_event function gets
> dictionary with some fields from the perf ring buffer
> (like ip, sym, callchain etc).
>
> But we miss quite a few fields we report now, for example,
> LBRs,data source,weight,transaction,iregs,uregs,and etc.
>
> This patch reports these fields for perf script python
> processing.
We need documentation and an example script using it.
> + PyObject *pyelem;
> +
> + pyelem = PyDict_New();
> + if (!pyelem)
> + Py_FatalError("couldn't create Python dictionary");
> +
I think we need a field for the dso here.
> + pydict_set_item_string_decref(pyelem, "from",
> + PyLong_FromUnsignedLongLong(br->entries[i].from));
> + pydict_set_item_string_decref(pyelem, "to",
> + PyLong_FromUnsignedLongLong(br->entries[i].to));
> + pydict_set_item_string_decref(pyelem, "mispred",
> + PyLong_FromUnsignedLongLong(br->entries[i].flags.mispred));
> + pydict_set_item_string_decref(pyelem, "predicted",
> + PyLong_FromUnsignedLongLong(br->entries[i].flags.predicted));
> + pydict_set_item_string_decref(pyelem, "in_tx",
> + PyLong_FromUnsignedLongLong(br->entries[i].flags.in_tx));
> + pydict_set_item_string_decref(pyelem, "abort",
These could be booleans.
> + PyLong_FromUnsignedLongLong(br->entries[i].flags.abort));
> + pydict_set_item_string_decref(pyelem, "cycles",
> + PyLong_FromUnsignedLongLong(br->entries[i].flags.cycles));
Would be nice to get access to the binary code too (see how perf script
brstackinsn does it). That could be a followon patch.
Thanks,
-Andi
Powered by blists - more mailing lists