aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@redhat.com>2012-03-15 15:09:14 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-03-16 13:06:06 -0400
commit641cc938815dfd09f8fa1ec72deb814f0938ac33 (patch)
tree8ced57a6b2d427bd34dcc30d3aebba3e0af45bb3 /include
parent4a3d2d9bfb3b594b6e1f2b7eabfaf4e820a18c0e (diff)
perf: Adding sysfs group format attribute for pmu device
Adding sysfs group 'format' attribute for pmu device that contains a syntax description on how to construct raw events. The event configuration is described in following struct pefr_event_attr attributes: config config1 config2 Each sysfs attribute within the format attribute group, describes mapping of name and bitfield definition within one of above attributes. eg: "/sys/...<dev>/format/event" contains "config:0-7" "/sys/...<dev>/format/umask" contains "config:8-15" "/sys/...<dev>/format/usr" contains "config:16" the attribute value syntax is: line: config ':' bits config: 'config' | 'config1' | 'config2" bits: bits ',' bit_term | bit_term bit_term: VALUE '-' VALUE | VALUE Adding format attribute definitions for x86 cpu pmus. Acked-by: Peter Zijlstra <peterz@infradead.org> Signed-off-by: Peter Zijlstra <peterz@infradead.org> Signed-off-by: Jiri Olsa <jolsa@redhat.com> Link: http://lkml.kernel.org/n/tip-vhdk5y2hyype9j63prymty36@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/perf_event.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index bd9f55a5958d..57ae485e80fc 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -550,6 +550,7 @@ struct perf_guest_info_callbacks {
550#include <linux/irq_work.h> 550#include <linux/irq_work.h>
551#include <linux/static_key.h> 551#include <linux/static_key.h>
552#include <linux/atomic.h> 552#include <linux/atomic.h>
553#include <linux/sysfs.h>
553#include <asm/local.h> 554#include <asm/local.h>
554 555
555#define PERF_MAX_STACK_DEPTH 255 556#define PERF_MAX_STACK_DEPTH 255
@@ -1291,5 +1292,18 @@ do { \
1291 register_cpu_notifier(&fn##_nb); \ 1292 register_cpu_notifier(&fn##_nb); \
1292} while (0) 1293} while (0)
1293 1294
1295
1296#define PMU_FORMAT_ATTR(_name, _format) \
1297static ssize_t \
1298_name##_show(struct device *dev, \
1299 struct device_attribute *attr, \
1300 char *page) \
1301{ \
1302 BUILD_BUG_ON(sizeof(_format) >= PAGE_SIZE); \
1303 return sprintf(page, _format "\n"); \
1304} \
1305 \
1306static struct device_attribute format_attr_##_name = __ATTR_RO(_name)
1307
1294#endif /* __KERNEL__ */ 1308#endif /* __KERNEL__ */
1295#endif /* _LINUX_PERF_EVENT_H */ 1309#endif /* _LINUX_PERF_EVENT_H */