Commit | Line | Data |
---|---|---|
1b29b018 SR |
1 | /* |
2 | * ring buffer based function tracer | |
3 | * | |
4 | * Copyright (C) 2007-2008 Steven Rostedt <srostedt@redhat.com> | |
5 | * Copyright (C) 2008 Ingo Molnar <mingo@redhat.com> | |
6 | * | |
7 | * Based on code from the latency_tracer, that is: | |
8 | * | |
9 | * Copyright (C) 2004-2006 Ingo Molnar | |
10 | * Copyright (C) 2004 William Lee Irwin III | |
11 | */ | |
1b29b018 SR |
12 | #include <linux/debugfs.h> |
13 | #include <linux/uaccess.h> | |
14 | #include <linux/ftrace.h> | |
2e0f5761 | 15 | #include <linux/fs.h> |
1b29b018 SR |
16 | |
17 | #include "trace.h" | |
18 | ||
e309b41d | 19 | static void start_function_trace(struct trace_array *tr) |
1b29b018 | 20 | { |
26bc83f4 | 21 | tr->cpu = get_cpu(); |
213cc060 | 22 | tracing_reset_online_cpus(tr); |
26bc83f4 SR |
23 | put_cpu(); |
24 | ||
41bc8144 | 25 | tracing_start_cmdline_record(); |
1b29b018 SR |
26 | tracing_start_function_trace(); |
27 | } | |
28 | ||
e309b41d | 29 | static void stop_function_trace(struct trace_array *tr) |
1b29b018 SR |
30 | { |
31 | tracing_stop_function_trace(); | |
41bc8144 | 32 | tracing_stop_cmdline_record(); |
1b29b018 SR |
33 | } |
34 | ||
1c80025a | 35 | static int function_trace_init(struct trace_array *tr) |
1b29b018 | 36 | { |
c76f0694 | 37 | start_function_trace(tr); |
1c80025a | 38 | return 0; |
1b29b018 SR |
39 | } |
40 | ||
e309b41d | 41 | static void function_trace_reset(struct trace_array *tr) |
1b29b018 | 42 | { |
c76f0694 | 43 | stop_function_trace(tr); |
1b29b018 SR |
44 | } |
45 | ||
9036990d SR |
46 | static void function_trace_start(struct trace_array *tr) |
47 | { | |
213cc060 | 48 | tracing_reset_online_cpus(tr); |
9036990d SR |
49 | } |
50 | ||
1b29b018 SR |
51 | static struct tracer function_trace __read_mostly = |
52 | { | |
3ce83aea | 53 | .name = "function", |
1b29b018 SR |
54 | .init = function_trace_init, |
55 | .reset = function_trace_reset, | |
9036990d | 56 | .start = function_trace_start, |
60a11774 SR |
57 | #ifdef CONFIG_FTRACE_SELFTEST |
58 | .selftest = trace_selftest_startup_function, | |
59 | #endif | |
1b29b018 SR |
60 | }; |
61 | ||
62 | static __init int init_function_trace(void) | |
63 | { | |
64 | return register_tracer(&function_trace); | |
65 | } | |
66 | ||
67 | device_initcall(init_function_trace); |