LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: "Jin, Yao" <yao.jin@linux.intel.com>
To: Andi Kleen <ak@linux.intel.com>
Cc: acme@kernel.org, jolsa@kernel.org, peterz@infradead.org,
	mingo@redhat.com, alexander.shishkin@linux.intel.com,
	Linux-kernel@vger.kernel.org, kan.liang@intel.com,
	yao.jin@intel.com
Subject: Re: [PATCH] perf util: Add more PMU fields for perf script python
Date: Thu, 31 May 2018 13:41:10 +0800	[thread overview]
Message-ID: <177a0a85-fd48-494e-e48b-4e88712c09d3@linux.intel.com> (raw)
In-Reply-To: <20180530174346.GE30764@tassilo.jf.intel.com>



On 5/31/2018 1:43 AM, Andi Kleen wrote:
> 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.
> 

OK, I will add an example with some field explanations to 
Documentation/perf-script-python.txt.

>> +		PyObject *pyelem;
>> +
>> +		pyelem = PyDict_New();
>> +		if (!pyelem)
>> +			Py_FatalError("couldn't create Python dictionary");
>> +
> 
> I think we need a field for the dso here.
>

I will add new fields "from_dsoname" and "to_dsoname" in v2.

>> +		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));

I will use PyBool_FromLong() for mispred/predicted/in_tx/abort in v2.

> 
> Would be nice to get access to the binary code too (see how perf script
> brstackinsn does it). That could be a followon patch.
>

OK, fine, I will see how perf script brstackinsn does.

Thanks
Jin Yao

> Thanks,
> 
> -Andi
> 

      reply	other threads:[~2018-05-31  5:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-30 14:20 Jin Yao
2018-05-30 17:43 ` Andi Kleen
2018-05-31  5:41   ` Jin, Yao [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=177a0a85-fd48-494e-e48b-4e88712c09d3@linux.intel.com \
    --to=yao.jin@linux.intel.com \
    --cc=Linux-kernel@vger.kernel.org \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@intel.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=yao.jin@intel.com \
    --subject='Re: [PATCH] perf util: Add more PMU fields for perf script python' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).