Re: [RFC][PATCH v2 11/11] perf top: demo of how to use the sysfs interface

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Corey Ashford
Date: Thursday, May 20, 2010 - 1:27 am

On 05/19/2010 07:08 PM, Lin Ming wrote:

I'm not sure I made the example clear.

Let's say I have a memory controller event called memory_write and it 
has two attributes: low_addr and high_addr... writes to addresses 
between the low_addr and high_addr will increment the counter.

As a user, I want to be able to specify a particular memory range, let's 
say 0x1000000..0x2000000

A sysfs structure like this might be constructed:
/sys/devices/system/node/events/memory_write
/sys/devices/system/node/events/memory_write/attr
/sys/devices/system/node/events/memory_write/attr/low_addr
/sys/devices/system/node/events/memory_write/attr/low_addr/min
/sys/devices/system/node/events/memory_write/attr/low_addr/max

In another posting I had also added a bit shift value, but there are so 
few bits left in the attr->config, that I'm not sure this is a very 
extensible mechanism, but just for the sake of illustration of the basic 
idea, I'll add it here:
/sys/devices/system/node/events/memory_write/attr/low_addr/shift

Then the same thing is repeated for the other attribute:
/sys/devices/system/node/events/memory_write/attr/high_addr
/sys/devices/system/node/events/memory_write/attr/high_addr/min
/sys/devices/system/node/events/memory_write/attr/high_addr/max
/sys/devices/system/node/events/memory_write/attr/high_addr/shift

In this scenario, a user tool (like perf) would be able to see that 
there are attributes associated with the memory_write event, and it 
knows the names and range of allowed values for these attributes.  The 
shift value tells the tool how much to shift the attribute value before 
OR'ing it into the attr->config value.

If we find that more than 64 bits are needed for the event code plus the 
attribute values, perhaps shift values greater than 64 would denote to 
place the attribute bits into a new attr field, like 
attr->config_extra[shift / 64]

On the perf command line, then, a user could specify something like:

perf stat -e node::memory_write:low_addr=0x1000000:high_addr=0x2000000

What do you think?

- Corey
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [RFC][PATCH v2 11/11] perf top: demo of how to use the ..., Corey Ashford, (Thu May 20, 1:27 am)