diff options
author | Li Zefan <lizf@cn.fujitsu.com> | 2009-10-14 23:21:42 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-10-15 05:35:23 -0400 |
commit | 6fb2915df7f0747d9044da9dbff5b46dc2e20830 (patch) | |
tree | b4c5d7d913362ae6161c2859a7a385263330e965 /include | |
parent | b0f1a59a98d7ac2102e7e4f22904c26d564a5628 (diff) |
tracing/profile: Add filter support
- Add an ioctl to allocate a filter for a perf event.
- Free the filter when the associated perf event is to be freed.
- Do the filtering in perf_swevent_match().
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <4AD69546.8050401@cn.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/ftrace_event.h | 11 | ||||
-rw-r--r-- | include/linux/perf_counter.h | 1 | ||||
-rw-r--r-- | include/linux/perf_event.h | 6 |
3 files changed, 17 insertions, 1 deletions
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h index 4ec5e67e18cf..d11770472bc8 100644 --- a/include/linux/ftrace_event.h +++ b/include/linux/ftrace_event.h | |||
@@ -144,7 +144,7 @@ extern char *trace_profile_buf_nmi; | |||
144 | #define MAX_FILTER_STR_VAL 256 /* Should handle KSYM_SYMBOL_LEN */ | 144 | #define MAX_FILTER_STR_VAL 256 /* Should handle KSYM_SYMBOL_LEN */ |
145 | 145 | ||
146 | extern void destroy_preds(struct ftrace_event_call *call); | 146 | extern void destroy_preds(struct ftrace_event_call *call); |
147 | extern int filter_match_preds(struct ftrace_event_call *call, void *rec); | 147 | extern int filter_match_preds(struct event_filter *filter, void *rec); |
148 | extern int filter_current_check_discard(struct ring_buffer *buffer, | 148 | extern int filter_current_check_discard(struct ring_buffer *buffer, |
149 | struct ftrace_event_call *call, | 149 | struct ftrace_event_call *call, |
150 | void *rec, | 150 | void *rec, |
@@ -186,4 +186,13 @@ do { \ | |||
186 | __trace_printk(ip, fmt, ##args); \ | 186 | __trace_printk(ip, fmt, ##args); \ |
187 | } while (0) | 187 | } while (0) |
188 | 188 | ||
189 | #ifdef CONFIG_EVENT_PROFILE | ||
190 | struct perf_event; | ||
191 | extern int ftrace_profile_enable(int event_id); | ||
192 | extern void ftrace_profile_disable(int event_id); | ||
193 | extern int ftrace_profile_set_filter(struct perf_event *event, int event_id, | ||
194 | char *filter_str); | ||
195 | extern void ftrace_profile_free_filter(struct perf_event *event); | ||
196 | #endif | ||
197 | |||
189 | #endif /* _LINUX_FTRACE_EVENT_H */ | 198 | #endif /* _LINUX_FTRACE_EVENT_H */ |
diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h index 7b7fbf433cff..91a2b4309e7a 100644 --- a/include/linux/perf_counter.h +++ b/include/linux/perf_counter.h | |||
@@ -225,6 +225,7 @@ struct perf_counter_attr { | |||
225 | #define PERF_COUNTER_IOC_RESET _IO ('$', 3) | 225 | #define PERF_COUNTER_IOC_RESET _IO ('$', 3) |
226 | #define PERF_COUNTER_IOC_PERIOD _IOW('$', 4, u64) | 226 | #define PERF_COUNTER_IOC_PERIOD _IOW('$', 4, u64) |
227 | #define PERF_COUNTER_IOC_SET_OUTPUT _IO ('$', 5) | 227 | #define PERF_COUNTER_IOC_SET_OUTPUT _IO ('$', 5) |
228 | #define PERF_COUNTER_IOC_SET_FILTER _IOW('$', 6, char *) | ||
228 | 229 | ||
229 | enum perf_counter_ioc_flags { | 230 | enum perf_counter_ioc_flags { |
230 | PERF_IOC_FLAG_GROUP = 1U << 0, | 231 | PERF_IOC_FLAG_GROUP = 1U << 0, |
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index 2e6d95f97419..df9d964c15fc 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h | |||
@@ -221,6 +221,7 @@ struct perf_event_attr { | |||
221 | #define PERF_EVENT_IOC_RESET _IO ('$', 3) | 221 | #define PERF_EVENT_IOC_RESET _IO ('$', 3) |
222 | #define PERF_EVENT_IOC_PERIOD _IOW('$', 4, u64) | 222 | #define PERF_EVENT_IOC_PERIOD _IOW('$', 4, u64) |
223 | #define PERF_EVENT_IOC_SET_OUTPUT _IO ('$', 5) | 223 | #define PERF_EVENT_IOC_SET_OUTPUT _IO ('$', 5) |
224 | #define PERF_EVENT_IOC_SET_FILTER _IOW('$', 6, char *) | ||
224 | 225 | ||
225 | enum perf_event_ioc_flags { | 226 | enum perf_event_ioc_flags { |
226 | PERF_IOC_FLAG_GROUP = 1U << 0, | 227 | PERF_IOC_FLAG_GROUP = 1U << 0, |
@@ -633,7 +634,12 @@ struct perf_event { | |||
633 | 634 | ||
634 | struct pid_namespace *ns; | 635 | struct pid_namespace *ns; |
635 | u64 id; | 636 | u64 id; |
637 | |||
638 | #ifdef CONFIG_EVENT_PROFILE | ||
639 | struct event_filter *filter; | ||
636 | #endif | 640 | #endif |
641 | |||
642 | #endif /* CONFIG_PERF_EVENTS */ | ||
637 | }; | 643 | }; |
638 | 644 | ||
639 | /** | 645 | /** |