linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* perf event attrributes
@ 2013-03-27 15:40 Freehill Christopher-RAT063
  2013-03-28  1:32 ` Andi Kleen
  0 siblings, 1 reply; 5+ messages in thread
From: Freehill Christopher-RAT063 @ 2013-03-27 15:40 UTC (permalink / raw)
  To: linux-perf-users

Hi,

I am working on adding support in perf for many events for a particular architecture.  As it is, there are thousands of events to add, with potentially many more. 

Instead of treating each event as a separate raw event number (e.g., "perf stat -e rXXXXX ."), I wondering if there is any existing support in the perf infrastructure to support event attributes? For example, if I have an event that represents "DDR hits", meaning all accesses to DDR, and I want to add support for DDR hits from a particular source, do I need to add a perf event for every possible source (e.g., "DDR access from source A", "DDR access from source B", .), or is  there a way to specify attributes for the event, in order to keep the number of events to a reasonable level, and also make it easier for the user? Something like "perf stat -e rXXXXX -source A"

The "Source"  is one example of an attribute. There are several others. If you wanted to add support for all of those variations without using some kind of attribute, the number of events would be difficult to implement in a "flat" way, due to the huge number of events required. Also, it seems not very useable. 

On the perf wiki, I see mention of "sub-events" and "unit masks", which could be applicable, but I cannot find any other info or examples on them, or see the related kernel code. I would like to use a kernel module to extend this, if possible.

Also, potentially related are modifiers (but it looks like those may not be something I could extend). I'm not sure.

Any info or suggestions are appreciated.

Thanks,
Chris

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: perf event attrributes
  2013-03-27 15:40 perf event attrributes Freehill Christopher-RAT063
@ 2013-03-28  1:32 ` Andi Kleen
  2013-04-01 16:09   ` Freehill Christopher-RAT063
  0 siblings, 1 reply; 5+ messages in thread
From: Andi Kleen @ 2013-03-28  1:32 UTC (permalink / raw)
  To: Freehill Christopher-RAT063; +Cc: linux-perf-users

Freehill Christopher-RAT063 <RAT063@freescale.com> writes:
>
> Any info or suggestions are appreciated.

The perf model for this is to use bit fields in config/config1 and then
declare those in sysfs, so that they can be set as cpu/foo=1,bar=2/
The kernel driver then extracts those fields.

This only supports numerical values, not string enumerations.

You can see the Intel uncore drivers as a example doing this extensively.

-Andi

-- 
ak@linux.intel.com -- Speaking for myself only

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: perf event attrributes
  2013-03-28  1:32 ` Andi Kleen
@ 2013-04-01 16:09   ` Freehill Christopher-RAT063
  2013-04-02  4:42     ` Namhyung Kim
  0 siblings, 1 reply; 5+ messages in thread
From: Freehill Christopher-RAT063 @ 2013-04-01 16:09 UTC (permalink / raw)
  To: Andi Kleen; +Cc: linux-perf-users

Andi,

Thanks for the response.

I am not familiar with "config/config1", but I infer from your message that I would make folders in sysfs for different event groups (?) and then have a file for each event that is a bit field that can be parsed. 

As an alternative, is there anything to prevent encoding the attributes in the event ID itself? I think there are 64 bits to use. Some of those could be interpreted in a way specific to the event. I can see advantages and disadvantage to both. 

Both ways seem a little convoluted from a user point of view. Seems like a more intuitive way would have been from the command line; ie, provide a way to pass info from the command line that could be interpreted in a way specific to the event. I'm sure that was probably considered, and there is a good reason that method wasn't chosen, but I do wonder...

Can you point me to the Intel uncore drivers you mentioned?

Thanks again,
Chris

-----Original Message-----
From: Andi Kleen [mailto:andi@firstfloor.org] 
Sent: Wednesday, March 27, 2013 8:32 PM
To: Freehill Christopher-RAT063
Cc: linux-perf-users
Subject: Re: perf event attrributes

Freehill Christopher-RAT063 <RAT063@freescale.com> writes:
>
> Any info or suggestions are appreciated.

The perf model for this is to use bit fields in config/config1 and then declare those in sysfs, so that they can be set as cpu/foo=1,bar=2/ The kernel driver then extracts those fields.

This only supports numerical values, not string enumerations.

You can see the Intel uncore drivers as a example doing this extensively.

-Andi

--
ak@linux.intel.com -- Speaking for myself only

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: perf event attrributes
  2013-04-01 16:09   ` Freehill Christopher-RAT063
@ 2013-04-02  4:42     ` Namhyung Kim
  2013-04-03 22:26       ` Freehill Christopher-RAT063
  0 siblings, 1 reply; 5+ messages in thread
From: Namhyung Kim @ 2013-04-02  4:42 UTC (permalink / raw)
  To: Freehill Christopher-RAT063; +Cc: Andi Kleen, linux-perf-users

Hi Chris,

On Mon, 1 Apr 2013 16:09:50 +0000, Freehill Christopher-RAT wrote:
> Andi,
>
> Thanks for the response.
>
> I am not familiar with "config/config1", but I infer from your message that I would make folders in sysfs for different event groups (?) and then have a file for each event that is a bit field that can be parsed. 
>
> As an alternative, is there anything to prevent encoding the attributes in the event ID itself? I think there are 64 bits to use. Some of those could be interpreted in a way specific to the event. I can see advantages and disadvantage to both. 
>
> Both ways seem a little convoluted from a user point of view. Seems
> like a more intuitive way would have been from the command line; ie,
> provide a way to pass info from the command line that could be
> interpreted in a way specific to the event. I'm sure that was probably
> considered, and there is a good reason that method wasn't chosen, but
> I do wonder...
>
> Can you point me to the Intel uncore drivers you mentioned?

You can see it under /sys/bus/event_source/devices/uncore_imc_*/ on a
recent kernel.  There'll be the "format" and "events" directories.

If you want to see the source, please go to:

  http://lxr.linux.no/#linux+v3.8.5/arch/x86/kernel/cpu/perf_event_intel_uncore.c


Thanks,
Namhyung

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: perf event attrributes
  2013-04-02  4:42     ` Namhyung Kim
@ 2013-04-03 22:26       ` Freehill Christopher-RAT063
  0 siblings, 0 replies; 5+ messages in thread
From: Freehill Christopher-RAT063 @ 2013-04-03 22:26 UTC (permalink / raw)
  To: Namhyung Kim; +Cc: Andi Kleen, linux-perf-users

> > Can you point me to the Intel uncore drivers you mentioned?
> 
> You can see it under /sys/bus/event_source/devices/uncore_imc_*/ on a
> recent kernel.  There'll be the "format" and "events" directories.

Thanks Namhyung. Installed Ubuntu 12.10 (with 3.5.0-17-generic) on VirtualBox. I'm not seeing this folder is it later than this?

Also, are you aware of any documentation on the usage?

Thanks,
Chris

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-04-03 22:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-27 15:40 perf event attrributes Freehill Christopher-RAT063
2013-03-28  1:32 ` Andi Kleen
2013-04-01 16:09   ` Freehill Christopher-RAT063
2013-04-02  4:42     ` Namhyung Kim
2013-04-03 22:26       ` Freehill Christopher-RAT063

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).