summaryrefslogtreecommitdiff
path: root/include/linux/perf_counter.h
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2009-02-26 22:43:46 +1100
committerPaul Mackerras <paulus@samba.org>2009-02-26 22:43:46 +1100
commitf3dfd2656deb81a0addee4f4ceff66b50a387388 (patch)
tree2d43269668b2a468a2bd2988b1937f9a71d458b4 /include/linux/perf_counter.h
parent742bd95ba96e19b3f7196c3a0834ebc17c8ba006 (diff)
downloadlwn-f3dfd2656deb81a0addee4f4ceff66b50a387388.tar.gz
lwn-f3dfd2656deb81a0addee4f4ceff66b50a387388.zip
perfcounters: fix a few minor cleanliness issues
This fixes three issues noticed by Arnd Bergmann: - Add #ifdef __KERNEL__ and move some things around in perf_counter.h to make sure only the bits that userspace needs are exported to userspace. - Use __u64, __s64, __u32 types in the structs exported to userspace rather than u64, s64, u32. - Make the sys_perf_counter_open syscall available to the SPUs on Cell platforms. And one issue that I noticed in looking at the code again: - Wrap the perf_counter_open syscall with SYSCALL_DEFINE4 so we get the proper handling of int arguments on ppc64 (and some other 64-bit architectures). Reported-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'include/linux/perf_counter.h')
-rw-r--r--include/linux/perf_counter.h43
1 files changed, 23 insertions, 20 deletions
diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index 32cd1acb7386..186efaf49665 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -13,20 +13,8 @@
#ifndef _LINUX_PERF_COUNTER_H
#define _LINUX_PERF_COUNTER_H
-#include <asm/atomic.h>
-#include <asm/ioctl.h>
-
-#ifdef CONFIG_PERF_COUNTERS
-# include <asm/perf_counter.h>
-#endif
-
-#include <linux/list.h>
-#include <linux/mutex.h>
-#include <linux/rculist.h>
-#include <linux/rcupdate.h>
-#include <linux/spinlock.h>
-
-struct task_struct;
+#include <linux/types.h>
+#include <linux/ioctl.h>
/*
* User-space ABI bits:
@@ -78,12 +66,12 @@ enum perf_counter_record_type {
* Hardware event to monitor via a performance monitoring counter:
*/
struct perf_counter_hw_event {
- s64 type;
+ __s64 type;
- u64 irq_period;
- u32 record_type;
+ __u64 irq_period;
+ __u32 record_type;
- u32 disabled : 1, /* off by default */
+ __u32 disabled : 1, /* off by default */
nmi : 1, /* NMI sampling */
raw : 1, /* raw event type */
inherit : 1, /* children inherit it */
@@ -95,7 +83,7 @@ struct perf_counter_hw_event {
__reserved_1 : 23;
- u64 __reserved_2;
+ __u64 __reserved_2;
};
/*
@@ -104,10 +92,24 @@ struct perf_counter_hw_event {
#define PERF_COUNTER_IOC_ENABLE _IO('$', 0)
#define PERF_COUNTER_IOC_DISABLE _IO('$', 1)
+#ifdef __KERNEL__
/*
- * Kernel-internal data types:
+ * Kernel-internal data types and definitions:
*/
+#ifdef CONFIG_PERF_COUNTERS
+# include <asm/perf_counter.h>
+#endif
+
+#include <linux/list.h>
+#include <linux/mutex.h>
+#include <linux/rculist.h>
+#include <linux/rcupdate.h>
+#include <linux/spinlock.h>
+#include <asm/atomic.h>
+
+struct task_struct;
+
/**
* struct hw_perf_counter - performance counter hardware details:
*/
@@ -293,4 +295,5 @@ static inline int perf_counter_task_disable(void) { return -EINVAL; }
static inline int perf_counter_task_enable(void) { return -EINVAL; }
#endif
+#endif /* __KERNEL__ */
#endif /* _LINUX_PERF_COUNTER_H */