diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-14 17:49:54 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-14 17:49:54 -0400 |
commit | e18425a0abc8eafa8e98ecffac517bb0c0904f4b (patch) | |
tree | 5eb743e7201850de19496183554bb34c766948c4 /kernel/trace/trace_functions.c | |
parent | d1794f2c5b5817eb79ccc5e00701ca748d1b073a (diff) | |
parent | 5806b81ac1c0c52665b91723fd4146a4f86e386b (diff) |
Merge branch 'tracing/for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'tracing/for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (228 commits)
ftrace: build fix for ftraced_suspend
ftrace: separate out the function enabled variable
ftrace: add ftrace_kill_atomic
ftrace: use current CPU for function startup
ftrace: start wakeup tracing after setting function tracer
ftrace: check proper config for preempt type
ftrace: trace schedule
ftrace: define function trace nop
ftrace: move sched_switch enable after markers
ftrace: prevent ftrace modifications while being kprobe'd, v2
fix "ftrace: store mcount address in rec->ip"
mmiotrace broken in linux-next (8-bit writes only)
ftrace: avoid modifying kprobe'd records
ftrace: freeze kprobe'd records
kprobes: enable clean usage of get_kprobe
ftrace: store mcount address in rec->ip
ftrace: build fix with gcc 4.3
namespacecheck: fixes
ftrace: fix "notrace" filtering priority
ftrace: fix printout
...
Diffstat (limited to 'kernel/trace/trace_functions.c')
-rw-r--r-- | kernel/trace/trace_functions.c | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/kernel/trace/trace_functions.c b/kernel/trace/trace_functions.c new file mode 100644 index 000000000000..312144897970 --- /dev/null +++ b/kernel/trace/trace_functions.c | |||
@@ -0,0 +1,81 @@ | |||
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 | */ | ||
12 | #include <linux/debugfs.h> | ||
13 | #include <linux/uaccess.h> | ||
14 | #include <linux/ftrace.h> | ||
15 | #include <linux/fs.h> | ||
16 | |||
17 | #include "trace.h" | ||
18 | |||
19 | static void function_reset(struct trace_array *tr) | ||
20 | { | ||
21 | int cpu; | ||
22 | |||
23 | tr->time_start = ftrace_now(tr->cpu); | ||
24 | |||
25 | for_each_online_cpu(cpu) | ||
26 | tracing_reset(tr->data[cpu]); | ||
27 | } | ||
28 | |||
29 | static void start_function_trace(struct trace_array *tr) | ||
30 | { | ||
31 | tr->cpu = get_cpu(); | ||
32 | function_reset(tr); | ||
33 | put_cpu(); | ||
34 | |||
35 | tracing_start_cmdline_record(); | ||
36 | tracing_start_function_trace(); | ||
37 | } | ||
38 | |||
39 | static void stop_function_trace(struct trace_array *tr) | ||
40 | { | ||
41 | tracing_stop_function_trace(); | ||
42 | tracing_stop_cmdline_record(); | ||
43 | } | ||
44 | |||
45 | static void function_trace_init(struct trace_array *tr) | ||
46 | { | ||
47 | if (tr->ctrl) | ||
48 | start_function_trace(tr); | ||
49 | } | ||
50 | |||
51 | static void function_trace_reset(struct trace_array *tr) | ||
52 | { | ||
53 | if (tr->ctrl) | ||
54 | stop_function_trace(tr); | ||
55 | } | ||
56 | |||
57 | static void function_trace_ctrl_update(struct trace_array *tr) | ||
58 | { | ||
59 | if (tr->ctrl) | ||
60 | start_function_trace(tr); | ||
61 | else | ||
62 | stop_function_trace(tr); | ||
63 | } | ||
64 | |||
65 | static struct tracer function_trace __read_mostly = | ||
66 | { | ||
67 | .name = "ftrace", | ||
68 | .init = function_trace_init, | ||
69 | .reset = function_trace_reset, | ||
70 | .ctrl_update = function_trace_ctrl_update, | ||
71 | #ifdef CONFIG_FTRACE_SELFTEST | ||
72 | .selftest = trace_selftest_startup_function, | ||
73 | #endif | ||
74 | }; | ||
75 | |||
76 | static __init int init_function_trace(void) | ||
77 | { | ||
78 | return register_tracer(&function_trace); | ||
79 | } | ||
80 | |||
81 | device_initcall(init_function_trace); | ||