diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2008-12-08 13:26:59 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-12-11 09:45:46 -0500 |
commit | eab656ae04b9d3b83265e3db01c0d2c46b748ef7 (patch) | |
tree | a8e12bd5a2da6032234dbb20ad2c75766b96c270 | |
parent | 4ac13294e44664bb7edf4daf52edb71e7c6bbe84 (diff) |
perf counters: clean up 'raw' type API
Impact: cleanup
Introduce a separate hw_event type.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | include/linux/perf_counter.h | 7 | ||||
-rw-r--r-- | include/linux/syscalls.h | 8 | ||||
-rw-r--r-- | kernel/perf_counter.c | 15 |
3 files changed, 18 insertions, 12 deletions
diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h index 5031b5614f25..daedd7d87c2a 100644 --- a/include/linux/perf_counter.h +++ b/include/linux/perf_counter.h | |||
@@ -38,6 +38,7 @@ enum hw_event_types { | |||
38 | * If this bit is set in the type, then trigger NMI sampling: | 38 | * If this bit is set in the type, then trigger NMI sampling: |
39 | */ | 39 | */ |
40 | PERF_COUNT_NMI = (1 << 30), | 40 | PERF_COUNT_NMI = (1 << 30), |
41 | PERF_COUNT_RAW = (1 << 31), | ||
41 | }; | 42 | }; |
42 | 43 | ||
43 | /* | 44 | /* |
@@ -49,6 +50,12 @@ enum perf_record_type { | |||
49 | PERF_RECORD_GROUP, | 50 | PERF_RECORD_GROUP, |
50 | }; | 51 | }; |
51 | 52 | ||
53 | struct perf_counter_event { | ||
54 | u32 hw_event_type; | ||
55 | u32 hw_event_period; | ||
56 | u64 hw_raw_ctrl; | ||
57 | }; | ||
58 | |||
52 | /** | 59 | /** |
53 | * struct hw_perf_counter - performance counter hardware details | 60 | * struct hw_perf_counter - performance counter hardware details |
54 | */ | 61 | */ |
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index 6cce728a6263..3ecd73d03daa 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h | |||
@@ -54,6 +54,7 @@ struct compat_stat; | |||
54 | struct compat_timeval; | 54 | struct compat_timeval; |
55 | struct robust_list_head; | 55 | struct robust_list_head; |
56 | struct getcpu_cache; | 56 | struct getcpu_cache; |
57 | struct perf_counter_event; | ||
57 | 58 | ||
58 | #include <linux/types.h> | 59 | #include <linux/types.h> |
59 | #include <linux/aio_abi.h> | 60 | #include <linux/aio_abi.h> |
@@ -625,9 +626,6 @@ asmlinkage long sys_fallocate(int fd, int mode, loff_t offset, loff_t len); | |||
625 | int kernel_execve(const char *filename, char *const argv[], char *const envp[]); | 626 | int kernel_execve(const char *filename, char *const argv[], char *const envp[]); |
626 | 627 | ||
627 | asmlinkage int | 628 | asmlinkage int |
628 | sys_perf_counter_open(u32 hw_event_type, | 629 | sys_perf_counter_open(struct perf_counter_event __user *uevent, u32 record_type, |
629 | u32 hw_event_period, | 630 | pid_t pid, int cpu, int masterfd); |
630 | u32 record_type, | ||
631 | pid_t pid, | ||
632 | int cpu); | ||
633 | #endif | 631 | #endif |
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c index 20508f053658..96c333a5b0fc 100644 --- a/kernel/perf_counter.c +++ b/kernel/perf_counter.c | |||
@@ -734,26 +734,27 @@ perf_counter_alloc(u32 hw_event_period, int cpu, u32 record_type) | |||
734 | * @pid: target pid | 734 | * @pid: target pid |
735 | */ | 735 | */ |
736 | asmlinkage int | 736 | asmlinkage int |
737 | sys_perf_counter_open(u32 hw_event_type, | 737 | sys_perf_counter_open(struct perf_counter_event __user *uevent, u32 record_type, |
738 | u32 hw_event_period, | 738 | pid_t pid, int cpu, int masterfd) |
739 | u32 record_type, | ||
740 | pid_t pid, | ||
741 | int cpu) | ||
742 | { | 739 | { |
743 | struct perf_counter_context *ctx; | 740 | struct perf_counter_context *ctx; |
741 | struct perf_counter_event event; | ||
744 | struct perf_counter *counter; | 742 | struct perf_counter *counter; |
745 | int ret; | 743 | int ret; |
746 | 744 | ||
745 | if (copy_from_user(&event, uevent, sizeof(event)) != 0) | ||
746 | return -EFAULT; | ||
747 | |||
747 | ctx = find_get_context(pid, cpu); | 748 | ctx = find_get_context(pid, cpu); |
748 | if (IS_ERR(ctx)) | 749 | if (IS_ERR(ctx)) |
749 | return PTR_ERR(ctx); | 750 | return PTR_ERR(ctx); |
750 | 751 | ||
751 | ret = -ENOMEM; | 752 | ret = -ENOMEM; |
752 | counter = perf_counter_alloc(hw_event_period, cpu, record_type); | 753 | counter = perf_counter_alloc(event.hw_event_period, cpu, record_type); |
753 | if (!counter) | 754 | if (!counter) |
754 | goto err_put_context; | 755 | goto err_put_context; |
755 | 756 | ||
756 | ret = hw_perf_counter_init(counter, hw_event_type); | 757 | ret = hw_perf_counter_init(counter, event.hw_event_type); |
757 | if (ret) | 758 | if (ret) |
758 | goto err_free_put_context; | 759 | goto err_free_put_context; |
759 | 760 | ||