diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-12-11 14:59:31 +0100 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-12-11 15:45:55 +0100 |
commit | 1d1c7ddbfab358445a542715551301b7fc363e28 (patch) | |
tree | d4421834d109b206f39c2019ea039fd42ed22e1d /kernel/sys.c | |
parent | bae43c9945ebeef15e7952e317efb02393d3bfc7 (diff) | |
download | kernel-crypto-1d1c7ddbfab358445a542715551301b7fc363e28.tar.gz kernel-crypto-1d1c7ddbfab358445a542715551301b7fc363e28.tar.xz kernel-crypto-1d1c7ddbfab358445a542715551301b7fc363e28.zip |
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 @@ #include <linux/prctl.h> #include <linux/highuid.h> #include <linux/fs.h> +#include <linux/perf_counter.h> #include <linux/resource.h> #include <linux/kernel.h> #include <linux/kexec.h> @@ -1716,6 +1717,12 @@ asmlinkage long sys_prctl(int option, unsigned long arg2, unsigned long arg3, case PR_SET_TSC: error = SET_TSC_CTL(arg2); break; + case PR_TASK_PERF_COUNTERS_DISABLE: + error = perf_counter_task_disable(); + break; + case PR_TASK_PERF_COUNTERS_ENABLE: + error = perf_counter_task_enable(); + break; case PR_GET_TIMERSLACK: error = current->timer_slack_ns; break; |