LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Andi Kleen <ak@linux.intel.com>
To: Jin Yao <yao.jin@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: Wed, 30 May 2018 10:43:46 -0700	[thread overview]
Message-ID: <20180530174346.GE30764@tassilo.jf.intel.com> (raw)
In-Reply-To: <1527690045-17987-1-git-send-email-yao.jin@linux.intel.com>

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

  reply	other threads:[~2018-05-30 17:43 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 [this message]
2018-05-31  5:41   ` Jin, Yao

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=20180530174346.GE30764@tassilo.jf.intel.com \
    --to=ak@linux.intel.com \
    --cc=Linux-kernel@vger.kernel.org \
    --cc=acme@kernel.org \
    --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 \
    --cc=yao.jin@linux.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).