summaryrefslogtreecommitdiffstats
path: root/kernel/trace/ftrace.c
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2008-05-12 21:20:45 +0200
committerThomas Gleixner <tglx@linutronix.de>2008-05-23 20:41:06 +0200
commit77a2b37d227483fe52aead242652aee406c25bf0 (patch)
treececb6a3a02a567530e2ce3502de18f371c9db7c1 /kernel/trace/ftrace.c
parent7bd2f24c2f769e3f8f1d4fc8b9fddf689825f6a7 (diff)
downloadblackbird-op-linux-77a2b37d227483fe52aead242652aee406c25bf0.tar.gz
blackbird-op-linux-77a2b37d227483fe52aead242652aee406c25bf0.zip
ftrace: startup tester on dynamic tracing.
This patch adds a startup self test on dynamic code modification and filters. The test filters on a specific function, makes sure that no other function is traced, exectutes the function, then makes sure that the function is traced. This patch also fixes a slight bug with the ftrace selftest, where tracer_enabled was not being set. Signed-off-by: Steven Rostedt <srostedt@redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/trace/ftrace.c')
-rw-r--r--kernel/trace/ftrace.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 6d4d2e86debc..5e9389faaf75 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -1010,6 +1010,25 @@ ftrace_filter_write(struct file *file, const char __user *ubuf,
return ret;
}
+/**
+ * ftrace_set_filter - set a function to filter on in ftrace
+ * @buf - the string that holds the function filter text.
+ * @len - the length of the string.
+ * @reset - non zero to reset all filters before applying this filter.
+ *
+ * Filters denote which functions should be enabled when tracing is enabled.
+ * If @buf is NULL and reset is set, all functions will be enabled for tracing.
+ */
+notrace void ftrace_set_filter(unsigned char *buf, int len, int reset)
+{
+ mutex_lock(&ftrace_filter_lock);
+ if (reset)
+ ftrace_filter_reset();
+ if (buf)
+ ftrace_match(buf, len);
+ mutex_unlock(&ftrace_filter_lock);
+}
+
static int notrace
ftrace_filter_release(struct inode *inode, struct file *file)
{
OpenPOWER on IntegriCloud