diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-12-11 08:59:31 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-12-11 09:45:55 -0500 |
commit | 1d1c7ddbfab358445a542715551301b7fc363e28 (patch) | |
tree | d4421834d109b206f39c2019ea039fd42ed22e1d /kernel/sys.c | |
parent | bae43c9945ebeef15e7952e317efb02393d3bfc7 (diff) |
perf counters: add prctl interface to disable/enable counters
Add a way for self-monitoring tasks to disable/enable counters summarily,
via a prctl:
PR_TASK_PERF_COUNTERS_DISABLE 31
PR_TASK_PERF_COUNTERS_ENABLE 32
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/sys.c')
-rw-r--r-- | kernel/sys.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/kernel/sys.c b/kernel/sys.c index 31deba8f7d1..0f66633be31 100644 --- a/kernel/sys.c +++ b/kernel/sys.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/prctl.h> | 14 | #include <linux/prctl.h> |
15 | #include <linux/highuid.h> | 15 | #include <linux/highuid.h> |
16 | #include <linux/fs.h> | 16 | #include <linux/fs.h> |
17 | #include <linux/perf_counter.h> | ||
17 | #include <linux/resource.h> | 18 | #include <linux/resource.h> |
18 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
19 | #include <linux/kexec.h> | 20 | #include <linux/kexec.h> |
@@ -1716,6 +1717,12 @@ asmlinkage long sys_prctl(int option, unsigned long arg2, unsigned long arg3, | |||
1716 | case PR_SET_TSC: | 1717 | case PR_SET_TSC: |
1717 | error = SET_TSC_CTL(arg2); | 1718 | error = SET_TSC_CTL(arg2); |
1718 | break; | 1719 | break; |
1720 | case PR_TASK_PERF_COUNTERS_DISABLE: | ||
1721 | error = perf_counter_task_disable(); | ||
1722 | break; | ||
1723 | case PR_TASK_PERF_COUNTERS_ENABLE: | ||
1724 | error = perf_counter_task_enable(); | ||
1725 | break; | ||
1719 | case PR_GET_TIMERSLACK: | 1726 | case PR_GET_TIMERSLACK: |
1720 | error = current->timer_slack_ns; | 1727 | error = current->timer_slack_ns; |
1721 | break; | 1728 | break; |