aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace_functions.c
diff options
context:
space:
mode:
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>2014-01-10 16:17:45 -0500
committerSteven Rostedt <rostedt@goodmis.org>2014-02-20 12:29:07 -0500
commit591dffdade9f07692a7dd3ed16830ec24e901ece (patch)
tree6f7b2702ef573fe393094bbf05625a00bb1410e4 /kernel/trace/trace_functions.c
parente3b3e2e847080e3cc14bee778c6ced3d59bfd76c (diff)
ftrace: Allow for function tracing instance to filter functions
Create a "set_ftrace_filter" and "set_ftrace_notrace" files in the instance directories to let users filter of functions to trace for the given instance. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/trace_functions.c')
-rw-r--r--kernel/trace/trace_functions.c40
1 files changed, 32 insertions, 8 deletions
diff --git a/kernel/trace/trace_functions.c b/kernel/trace/trace_functions.c
index 3f8dc1ce8b9c..5b781d2be383 100644
--- a/kernel/trace/trace_functions.c
+++ b/kernel/trace/trace_functions.c
@@ -52,10 +52,34 @@ static int allocate_ftrace_ops(struct trace_array *tr)
52 return 0; 52 return 0;
53} 53}
54 54
55
56int ftrace_create_function_files(struct trace_array *tr,
57 struct dentry *parent)
58{
59 int ret;
60
61 /* The top level array uses the "global_ops". */
62 if (!(tr->flags & TRACE_ARRAY_FL_GLOBAL)) {
63 ret = allocate_ftrace_ops(tr);
64 if (ret)
65 return ret;
66 }
67
68 ftrace_create_filter_files(tr->ops, parent);
69
70 return 0;
71}
72
73void ftrace_destroy_function_files(struct trace_array *tr)
74{
75 ftrace_destroy_filter_files(tr->ops);
76 kfree(tr->ops);
77 tr->ops = NULL;
78}
79
55static int function_trace_init(struct trace_array *tr) 80static int function_trace_init(struct trace_array *tr)
56{ 81{
57 struct ftrace_ops *ops; 82 struct ftrace_ops *ops;
58 int ret;
59 83
60 if (tr->flags & TRACE_ARRAY_FL_GLOBAL) { 84 if (tr->flags & TRACE_ARRAY_FL_GLOBAL) {
61 /* There's only one global tr */ 85 /* There's only one global tr */
@@ -69,10 +93,13 @@ static int function_trace_init(struct trace_array *tr)
69 else 93 else
70 ops = &trace_ops; 94 ops = &trace_ops;
71 tr->ops = ops; 95 tr->ops = ops;
72 } else { 96 } else if (!tr->ops) {
73 ret = allocate_ftrace_ops(tr); 97 /*
74 if (ret) 98 * Instance trace_arrays get their ops allocated
75 return ret; 99 * at instance creation. Unless it failed
100 * the allocation.
101 */
102 return -ENOMEM;
76 } 103 }
77 104
78 tr->trace_buffer.cpu = get_cpu(); 105 tr->trace_buffer.cpu = get_cpu();
@@ -87,9 +114,6 @@ static void function_trace_reset(struct trace_array *tr)
87{ 114{
88 tracing_stop_function_trace(tr); 115 tracing_stop_function_trace(tr);
89 tracing_stop_cmdline_record(); 116 tracing_stop_cmdline_record();
90 if (!(tr->flags & TRACE_ARRAY_FL_GLOBAL))
91 kfree(tr->ops);
92 tr->ops = NULL;
93} 117}
94 118
95static void function_trace_start(struct trace_array *tr) 119static void function_trace_start(struct trace_array *tr)