Thread (12 messages) 12 messages, 6 authors, 2012-10-31

Re: [RFC][PATCH] perf: Add a few generic stalled-cycles events

From: Peter Zijlstra <peterz@infradead.org>
Date: 2012-10-24 12:28:16
Also in: lkml

On Tue, 2012-10-16 at 11:31 -0700, Sukadev Bhattiprolu wrote:
On a side note, how does the kernel on x86 use the 'config' information i=
n=20
say /sys/bus/event_source/devices/cpu/format/cccr ? On Power7, the raw
code encodes the information such as the PMC to use for the event. Is tha=
t
how the 'config' info in Intel is used ?
=20
Does the 'config' info change from system to system or is it static for
a given event on a given CPU ?=20
Have a look at commits (tip/master):

  641cc938815dfd09f8fa1ec72deb814f0938ac33
  a47473939db20e3961b200eb00acf5fcf084d755
  43c032febde48aabcf6d59f47cdcb7b5debbdc63


So basically

 /sys/bus/event_source/devices/cpu/format/event

contains something like:

  config:0-7

Which says that for the 'cpu' PMU, field 'event' fills
perf_event_attr::config bits 0 through 7 (for type=3DPERF_TYPE_RAW).

The perf tool syntax for this is:

  perf stat -e 'cpu/event=3D0x3c/'

This basically allows you to expose bitfields in the 'raw' event format
for ease of writing raw events. I do not know if the Power PMU has such
or not.

Using this,

  /sys/bus/event_source/devices/cpu/events/cpu-cycles

would contain something like:

  event=3D0x3c

which one can use as:

  perf stat -e 'cpu/event=3Dcpu-cycles/'
  perf stat -e 'cpu/cpu-cycles/'

The tool will then read the sysfs file, substitute the content to
obtain:

  perf stat -e 'cpu/event=3D0x3c/'

and run with that.

Within all this, the perf_event_attr::config* field names are hard-coded
special, so 'cpu/config=3D0xffff/' will always work, even without sysfs
format/ specification and is equivalent to the raw event stuff we had
before.


If the Power PMU lacks any structure to the raw config, you could simply
provide sysfs event/ files with:

  config=3D0xdeadbeef

like content.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help