]>
Commit | Line | Data |
---|---|---|
1b29b018 SR |
1 | /* |
2 | * ring buffer based function tracer | |
3 | * | |
4 | * Copyright (C) 2007-2008 Steven Rostedt <[email protected]> | |
5 | * Copyright (C) 2008 Ingo Molnar <[email protected]> | |
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 function_reset(struct trace_array *tr) |
1b29b018 SR |
20 | { |
21 | int cpu; | |
22 | ||
750ed1a4 | 23 | tr->time_start = ftrace_now(tr->cpu); |
1b29b018 SR |
24 | |
25 | for_each_online_cpu(cpu) | |
3928a8a2 | 26 | tracing_reset(tr, cpu); |
1b29b018 SR |
27 | } |
28 | ||
e309b41d | 29 | static void start_function_trace(struct trace_array *tr) |
1b29b018 | 30 | { |
26bc83f4 | 31 | tr->cpu = get_cpu(); |
1b29b018 | 32 | function_reset(tr); |
26bc83f4 SR |
33 | put_cpu(); |
34 | ||
41bc8144 | 35 | tracing_start_cmdline_record(); |
1b29b018 SR |
36 | tracing_start_function_trace(); |
37 | } | |
38 | ||
e309b41d | 39 | static void stop_function_trace(struct trace_array *tr) |
1b29b018 SR |
40 | { |
41 | tracing_stop_function_trace(); | |
41bc8144 | 42 | tracing_stop_cmdline_record(); |
1b29b018 SR |
43 | } |
44 | ||
e309b41d | 45 | static void function_trace_init(struct trace_array *tr) |
1b29b018 | 46 | { |
c76f0694 | 47 | start_function_trace(tr); |
1b29b018 SR |
48 | } |
49 | ||
e309b41d | 50 | static void function_trace_reset(struct trace_array *tr) |
1b29b018 | 51 | { |
c76f0694 | 52 | stop_function_trace(tr); |
1b29b018 SR |
53 | } |
54 | ||
9036990d SR |
55 | static void function_trace_start(struct trace_array *tr) |
56 | { | |
57 | function_reset(tr); | |
58 | } | |
59 | ||
1b29b018 SR |
60 | static struct tracer function_trace __read_mostly = |
61 | { | |
3ce83aea | 62 | .name = "function", |
1b29b018 SR |
63 | .init = function_trace_init, |
64 | .reset = function_trace_reset, | |
9036990d | 65 | .start = function_trace_start, |
60a11774 SR |
66 | #ifdef CONFIG_FTRACE_SELFTEST |
67 | .selftest = trace_selftest_startup_function, | |
68 | #endif | |
1b29b018 SR |
69 | }; |
70 | ||
71 | static __init int init_function_trace(void) | |
72 | { | |
73 | return register_tracer(&function_trace); | |
74 | } | |
75 | ||
76 | device_initcall(init_function_trace); |