|
@@ -1316,9 +1316,16 @@ static struct attribute_group x86_pmu_format_group = {
|
|
|
*/
|
|
|
static void __init filter_events(struct attribute **attrs)
|
|
|
{
|
|
|
+ struct device_attribute *d;
|
|
|
+ struct perf_pmu_events_attr *pmu_attr;
|
|
|
int i, j;
|
|
|
|
|
|
for (i = 0; attrs[i]; i++) {
|
|
|
+ d = (struct device_attribute *)attrs[i];
|
|
|
+ pmu_attr = container_of(d, struct perf_pmu_events_attr, attr);
|
|
|
+ /* str trumps id */
|
|
|
+ if (pmu_attr->event_str)
|
|
|
+ continue;
|
|
|
if (x86_pmu.event_map(i))
|
|
|
continue;
|
|
|
|
|
@@ -1361,17 +1368,14 @@ static ssize_t events_sysfs_show(struct device *dev, struct device_attribute *at
|
|
|
{
|
|
|
struct perf_pmu_events_attr *pmu_attr = \
|
|
|
container_of(attr, struct perf_pmu_events_attr, attr);
|
|
|
-
|
|
|
u64 config = x86_pmu.event_map(pmu_attr->id);
|
|
|
- return x86_pmu.events_sysfs_show(page, config);
|
|
|
-}
|
|
|
|
|
|
-#define EVENT_VAR(_id) event_attr_##_id
|
|
|
-#define EVENT_PTR(_id) &event_attr_##_id.attr.attr
|
|
|
+ /* string trumps id */
|
|
|
+ if (pmu_attr->event_str)
|
|
|
+ return sprintf(page, "%s", pmu_attr->event_str);
|
|
|
|
|
|
-#define EVENT_ATTR(_name, _id) \
|
|
|
- PMU_EVENT_ATTR(_name, EVENT_VAR(_id), PERF_COUNT_HW_##_id, \
|
|
|
- events_sysfs_show)
|
|
|
+ return x86_pmu.events_sysfs_show(page, config);
|
|
|
+}
|
|
|
|
|
|
EVENT_ATTR(cpu-cycles, CPU_CYCLES );
|
|
|
EVENT_ATTR(instructions, INSTRUCTIONS );
|