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>
This commit is contained in:
parent
339f7c90b8
commit
79f1464156
2 changed files with 50 additions and 13 deletions
|
@ -155,8 +155,9 @@ struct perf_counter_hw_event {
|
|||
/*
|
||||
* Ioctls that can be done on a perf counter fd:
|
||||
*/
|
||||
#define PERF_COUNTER_IOC_ENABLE _IO('$', 0)
|
||||
#define PERF_COUNTER_IOC_DISABLE _IO('$', 1)
|
||||
#define PERF_COUNTER_IOC_ENABLE _IO ('$', 0)
|
||||
#define PERF_COUNTER_IOC_DISABLE _IO ('$', 1)
|
||||
#define PERF_COUNTER_IOC_REFRESH _IOW('$', 2, u32)
|
||||
|
||||
/*
|
||||
* Structure of the page that can be mapped via mmap
|
||||
|
@ -403,9 +404,14 @@ struct perf_counter {
|
|||
/* poll related */
|
||||
wait_queue_head_t waitq;
|
||||
struct fasync_struct *fasync;
|
||||
/* optional: for NMIs */
|
||||
|
||||
/* delayed work for NMIs and such */
|
||||
int pending_wakeup;
|
||||
int pending_disable;
|
||||
struct perf_pending_entry pending;
|
||||
|
||||
atomic_t event_limit;
|
||||
|
||||
void (*destroy)(struct perf_counter *);
|
||||
struct rcu_head rcu_head;
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue