aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/trace/Kconfig10
-rw-r--r--kernel/trace/Makefile1
-rw-r--r--kernel/trace/trace.h4
-rw-r--r--kernel/trace/trace_nop.c65
-rw-r--r--kernel/trace/trace_selftest.c9
5 files changed, 89 insertions, 0 deletions
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index 16e5bb5daaa5..d7b2de744631 100644
--- a/kernel/trace/Kconfig
+++ b/kernel/trace/Kconfig
@@ -101,6 +101,16 @@ config SCHED_TRACER
101 This tracer tracks the latency of the highest priority task 101 This tracer tracks the latency of the highest priority task
102 to be scheduled in, starting from the point it has woken up. 102 to be scheduled in, starting from the point it has woken up.
103 103
104config NOP_TRACER
105 bool "NOP Tracer"
106 depends on HAVE_FTRACE
107 depends on DEBUG_KERNEL
108 select TRACING
109 help
110 This tracer does nothing. The primary purpose for it is to
111 politely print the output of ftrace_printk() calls without
112 the overhead of an irrelevant trace taking place.
113
104config CONTEXT_SWITCH_TRACER 114config CONTEXT_SWITCH_TRACER
105 bool "Trace process context switches" 115 bool "Trace process context switches"
106 depends on HAVE_FTRACE 116 depends on HAVE_FTRACE
diff --git a/kernel/trace/Makefile b/kernel/trace/Makefile
index 58ec61c44bd6..73ba13f5a461 100644
--- a/kernel/trace/Makefile
+++ b/kernel/trace/Makefile
@@ -19,6 +19,7 @@ obj-$(CONFIG_FTRACE) += trace_functions.o
19obj-$(CONFIG_IRQSOFF_TRACER) += trace_irqsoff.o 19obj-$(CONFIG_IRQSOFF_TRACER) += trace_irqsoff.o
20obj-$(CONFIG_PREEMPT_TRACER) += trace_irqsoff.o 20obj-$(CONFIG_PREEMPT_TRACER) += trace_irqsoff.o
21obj-$(CONFIG_SCHED_TRACER) += trace_sched_wakeup.o 21obj-$(CONFIG_SCHED_TRACER) += trace_sched_wakeup.o
22obj-$(CONFIG_NOP_TRACER) += trace_nop.o
22obj-$(CONFIG_STACK_TRACER) += trace_stack.o 23obj-$(CONFIG_STACK_TRACER) += trace_stack.o
23obj-$(CONFIG_MMIOTRACE) += trace_mmiotrace.o 24obj-$(CONFIG_MMIOTRACE) += trace_mmiotrace.o
24 25
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index 42f65d0097f0..447d4b9b6391 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -339,6 +339,10 @@ extern int trace_selftest_startup_preemptirqsoff(struct tracer *trace,
339extern int trace_selftest_startup_wakeup(struct tracer *trace, 339extern int trace_selftest_startup_wakeup(struct tracer *trace,
340 struct trace_array *tr); 340 struct trace_array *tr);
341#endif 341#endif
342#ifdef CONFIG_NOP_TRACER
343extern int trace_selftest_startup_nop(struct tracer *trace,
344 struct trace_array *tr);
345#endif
342#ifdef CONFIG_CONTEXT_SWITCH_TRACER 346#ifdef CONFIG_CONTEXT_SWITCH_TRACER
343extern int trace_selftest_startup_sched_switch(struct tracer *trace, 347extern int trace_selftest_startup_sched_switch(struct tracer *trace,
344 struct trace_array *tr); 348 struct trace_array *tr);
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
15static struct trace_array *ctx_trace;
16
17static void start_nop_trace(struct trace_array *tr)
18{
19 /* Nothing to do! */
20}
21
22static void stop_nop_trace(struct trace_array *tr)
23{
24 /* Nothing to do! */
25}
26
27static 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
35static void nop_trace_reset(struct trace_array *tr)
36{
37 if (tr->ctrl)
38 stop_nop_trace(tr);
39}
40
41static 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
50static 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}
65device_initcall(init_nop_trace);
diff --git a/kernel/trace/trace_selftest.c b/kernel/trace/trace_selftest.c
index 630715bbd572..82db9103b9bc 100644
--- a/kernel/trace/trace_selftest.c
+++ b/kernel/trace/trace_selftest.c
@@ -418,6 +418,15 @@ trace_selftest_startup_preemptirqsoff(struct tracer *trace, struct trace_array *
418} 418}
419#endif /* CONFIG_IRQSOFF_TRACER && CONFIG_PREEMPT_TRACER */ 419#endif /* CONFIG_IRQSOFF_TRACER && CONFIG_PREEMPT_TRACER */
420 420
421#ifdef CONFIG_NOP_TRACER
422int
423trace_selftest_startup_nop(struct tracer *trace, struct trace_array *tr)
424{
425 /* What could possibly go wrong? */
426 return 0;
427}
428#endif
429
421#ifdef CONFIG_SCHED_TRACER 430#ifdef CONFIG_SCHED_TRACER
422static int trace_wakeup_test_thread(void *data) 431static int trace_wakeup_test_thread(void *data)
423{ 432{