lkml.org 
[lkml]   [2012]   [Nov]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/4] perf/POWER7: Make event translations available in sysfs
On Wed, Nov 07, 2012 at 11:19:28AM -0800, Sukadev Bhattiprolu wrote:

SNIP

> +struct perf_pmu_events_attr {
> + struct device_attribute attr;
> + u64 id;
> +};
> +
> +extern ssize_t power_events_sysfs_show(struct device *dev,
> + struct device_attribute *attr, char *page);
> +
> +#define EVENT_VAR(_id) event_attr_##_id
> +#define EVENT_PTR(_id) &event_attr_##_id.attr.attr
> +
> +#define EVENT_ATTR(_name, _id) \
> + static struct perf_pmu_events_attr EVENT_VAR(_id) = { \
> + .attr = __ATTR(_name, 0444, power_events_sysfs_show, NULL),\
> + .id = PM_##_id, \
> + };

this is duplicating the x86 code, perhaps it could be moved
to include/linux/perf_event.h and shared globaly


> diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c
> index aa2465e..19b23bd 100644
> --- a/arch/powerpc/perf/core-book3s.c
> +++ b/arch/powerpc/perf/core-book3s.c
> @@ -1305,6 +1305,16 @@ static int power_pmu_event_idx(struct perf_event *event)
> return event->hw.idx;
> }
>
> +ssize_t power_events_sysfs_show(struct device *dev,
> + struct device_attribute *attr, char *page)
> +{
> + struct perf_pmu_events_attr *pmu_attr;
> +
> + pmu_attr = container_of(attr, struct perf_pmu_events_attr, attr);
> +
> + return sprintf(page, "event=0x%02llx\n", pmu_attr->id);

whitespace issues


jirka


\
 
 \ /
  Last update: 2012-11-14 12:01    [W:0.165 / U:0.328 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site