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

Peter Zijlstra peterz at infradead.org
Wed Oct 24 23:27:42 EST 2012

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 in 
> 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 that
> how the 'config' info in Intel is used ?
> Does the 'config' info change from system to system or is it static for
> a given event on a given CPU ? 

Have a look at commits (tip/master):


So basically


contains something like:


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

The perf tool syntax for this is:

  perf stat -e 'cpu/event=0x3c/'

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,


would contain something like:


which one can use as:

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

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

  perf stat -e 'cpu/event=0x3c/'

and run with that.

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

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


like content.

More information about the Linuxppc-dev mailing list