diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2009-04-06 05:45:07 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-04-07 04:48:58 -0400 |
commit | 79f146415623fe74f39af67c0f6adc208939a410 (patch) | |
tree | 2b8b3ac045b21cce1169b55bd298a93dba4a19b3 /include/linux/perf_counter.h | |
parent | 339f7c90b8a2f3aa2dd4267e79f797999e8a3c59 (diff) |
perf_counter: counter overflow limit
Provide means to auto-disable the counter after 'n' overflow events.
Create the counter with hw_event.disabled = 1, and then issue an
ioctl(fd, PREF_COUNTER_IOC_REFRESH, n); to set the limit and enable
the counter.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
LKML-Reference: <20090406094518.083139737@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/linux/perf_counter.h')
-rw-r--r-- | include/linux/perf_counter.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h index 928a7fae0961..ef4dcbff75ab 100644 --- a/include/linux/perf_counter.h +++ b/include/linux/perf_counter.h | |||
@@ -155,8 +155,9 @@ struct perf_counter_hw_event { | |||
155 | /* | 155 | /* |
156 | * Ioctls that can be done on a perf counter fd: | 156 | * Ioctls that can be done on a perf counter fd: |
157 | */ | 157 | */ |
158 | #define PERF_COUNTER_IOC_ENABLE _IO('$', 0) | 158 | #define PERF_COUNTER_IOC_ENABLE _IO ('$', 0) |
159 | #define PERF_COUNTER_IOC_DISABLE _IO('$', 1) | 159 | #define PERF_COUNTER_IOC_DISABLE _IO ('$', 1) |
160 | #define PERF_COUNTER_IOC_REFRESH _IOW('$', 2, u32) | ||
160 | 161 | ||
161 | /* | 162 | /* |
162 | * Structure of the page that can be mapped via mmap | 163 | * Structure of the page that can be mapped via mmap |
@@ -403,9 +404,14 @@ struct perf_counter { | |||
403 | /* poll related */ | 404 | /* poll related */ |
404 | wait_queue_head_t waitq; | 405 | wait_queue_head_t waitq; |
405 | struct fasync_struct *fasync; | 406 | struct fasync_struct *fasync; |
406 | /* optional: for NMIs */ | 407 | |
408 | /* delayed work for NMIs and such */ | ||
409 | int pending_wakeup; | ||
410 | int pending_disable; | ||
407 | struct perf_pending_entry pending; | 411 | struct perf_pending_entry pending; |
408 | 412 | ||
413 | atomic_t event_limit; | ||
414 | |||
409 | void (*destroy)(struct perf_counter *); | 415 | void (*destroy)(struct perf_counter *); |
410 | struct rcu_head rcu_head; | 416 | struct rcu_head rcu_head; |
411 | #endif | 417 | #endif |