diff options
author | Steven Noonan <steven@uplinklabs.net> | 2008-09-19 06:06:43 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-10-14 04:37:43 -0400 |
commit | fb1b6d8b5154c692172a424e45fbd0573295cb93 (patch) | |
tree | d9a7ad2c629a6133998402354e77cd721e4962b4 /kernel/trace/trace_nop.c | |
parent | 5bf9a1ee350a10feb94107de32a203d81fbbe706 (diff) |
ftrace: add nop tracer
A no-op tracer which can serve two purposes:
1. A template for development of a new tracer.
2. A convenient way to see ftrace_printk() calls without
an irrelevant trace making the output messy.
[ mingo@elte.hu: resolved conflicts ]
Signed-off-by: Steven Noonan <steven@uplinklabs.net>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/trace/trace_nop.c')
-rw-r--r-- | kernel/trace/trace_nop.c | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/kernel/trace/trace_nop.c b/kernel/trace/trace_nop.c new file mode 100644 index 000000000000..dafaefb84038 --- /dev/null +++ b/kernel/trace/trace_nop.c | |||
@@ -0,0 +1,65 @@ | |||
1 | /* | ||
2 | * nop tracer | ||
3 | * | ||
4 | * Copyright (C) 2008 Steven Noonan <steven@uplinklabs.net> | ||
5 | * | ||
6 | */ | ||
7 | |||
8 | #include <linux/module.h> | ||
9 | #include <linux/fs.h> | ||
10 | #include <linux/debugfs.h> | ||
11 | #include <linux/ftrace.h> | ||
12 | |||
13 | #include "trace.h" | ||
14 | |||
15 | static struct trace_array *ctx_trace; | ||
16 | |||
17 | static void start_nop_trace(struct trace_array *tr) | ||
18 | { | ||
19 | /* Nothing to do! */ | ||
20 | } | ||
21 | |||
22 | static void stop_nop_trace(struct trace_array *tr) | ||
23 | { | ||
24 | /* Nothing to do! */ | ||
25 | } | ||
26 | |||
27 | static void nop_trace_init(struct trace_array *tr) | ||
28 | { | ||
29 | ctx_trace = tr; | ||
30 | |||
31 | if (tr->ctrl) | ||
32 | start_nop_trace(tr); | ||
33 | } | ||
34 | |||
35 | static void nop_trace_reset(struct trace_array *tr) | ||
36 | { | ||
37 | if (tr->ctrl) | ||
38 | stop_nop_trace(tr); | ||
39 | } | ||
40 | |||
41 | static void nop_trace_ctrl_update(struct trace_array *tr) | ||
42 | { | ||
43 | /* When starting a new trace, reset the buffers */ | ||
44 | if (tr->ctrl) | ||
45 | start_nop_trace(tr); | ||
46 | else | ||
47 | stop_nop_trace(tr); | ||
48 | } | ||
49 | |||
50 | static struct tracer nop_trace __read_mostly = | ||
51 | { | ||
52 | .name = "nop", | ||
53 | .init = nop_trace_init, | ||
54 | .reset = nop_trace_reset, | ||
55 | .ctrl_update = nop_trace_ctrl_update, | ||
56 | #ifdef CONFIG_FTRACE_SELFTEST | ||
57 | .selftest = trace_selftest_startup_nop, | ||
58 | #endif | ||
59 | }; | ||
60 | |||
61 | __init static int init_nop_trace(void) | ||
62 | { | ||
63 | return register_tracer(&nop_trace); | ||
64 | } | ||
65 | device_initcall(init_nop_trace); | ||