diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2009-10-18 09:33:50 -0400 |
---|---|---|
committer | Frederic Weisbecker <fweisbec@gmail.com> | 2009-11-03 13:11:53 -0500 |
commit | 97eaf5300b9d0cd99c310bf8c4a0f2f3296d88a3 (patch) | |
tree | aa047f4c078e2c9aeabcbcc9e33d93a50366b8e9 /include | |
parent | 41a48d14f6991020c9bb6b93e289ca5b411ed09a (diff) |
perf/core: Add a callback to perf events
A simple callback in a perf event can be used for multiple purposes.
For example it is useful for triggered based events like hardware
breakpoints that need a callback to dispatch a triggered breakpoint
event.
v2: Simplify a bit the callback attribution as suggested by Paul
Mackerras
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: "K.Prasad" <prasad@linux.vnet.ibm.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/perf_event.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index fa151d49a2ee..8d54e6d25eeb 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h | |||
@@ -544,6 +544,8 @@ struct perf_pending_entry { | |||
544 | void (*func)(struct perf_pending_entry *); | 544 | void (*func)(struct perf_pending_entry *); |
545 | }; | 545 | }; |
546 | 546 | ||
547 | typedef void (*perf_callback_t)(struct perf_event *, void *); | ||
548 | |||
547 | /** | 549 | /** |
548 | * struct perf_event - performance event kernel representation: | 550 | * struct perf_event - performance event kernel representation: |
549 | */ | 551 | */ |
@@ -639,6 +641,8 @@ struct perf_event { | |||
639 | struct event_filter *filter; | 641 | struct event_filter *filter; |
640 | #endif | 642 | #endif |
641 | 643 | ||
644 | perf_callback_t callback; | ||
645 | |||
642 | #endif /* CONFIG_PERF_EVENTS */ | 646 | #endif /* CONFIG_PERF_EVENTS */ |
643 | }; | 647 | }; |
644 | 648 | ||
@@ -748,7 +752,8 @@ extern int perf_event_release_kernel(struct perf_event *event); | |||
748 | extern struct perf_event * | 752 | extern struct perf_event * |
749 | perf_event_create_kernel_counter(struct perf_event_attr *attr, | 753 | perf_event_create_kernel_counter(struct perf_event_attr *attr, |
750 | int cpu, | 754 | int cpu, |
751 | pid_t pid); | 755 | pid_t pid, |
756 | perf_callback_t callback); | ||
752 | extern u64 perf_event_read_value(struct perf_event *event); | 757 | extern u64 perf_event_read_value(struct perf_event *event); |
753 | 758 | ||
754 | struct perf_sample_data { | 759 | struct perf_sample_data { |