blob: 9fb02c17ad0c73bf33d0af8b48c6ce69f6a51c63 [file] [log] [blame]
Steven Noonanfb1b6d82008-09-19 03:06:43 -07001/*
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{
Frédéric Weisbecker35cb5ed2008-09-21 20:10:14 +020029 int cpu;
Steven Noonanfb1b6d82008-09-19 03:06:43 -070030 ctx_trace = tr;
31
Frédéric Weisbecker35cb5ed2008-09-21 20:10:14 +020032 for_each_online_cpu(cpu)
33 tracing_reset(tr->data[cpu]);
34
Steven Noonanfb1b6d82008-09-19 03:06:43 -070035 if (tr->ctrl)
36 start_nop_trace(tr);
37}
38
39static void nop_trace_reset(struct trace_array *tr)
40{
41 if (tr->ctrl)
42 stop_nop_trace(tr);
43}
44
45static void nop_trace_ctrl_update(struct trace_array *tr)
46{
47 /* When starting a new trace, reset the buffers */
48 if (tr->ctrl)
49 start_nop_trace(tr);
50 else
51 stop_nop_trace(tr);
52}
53
54static struct tracer nop_trace __read_mostly =
55{
56 .name = "nop",
57 .init = nop_trace_init,
58 .reset = nop_trace_reset,
59 .ctrl_update = nop_trace_ctrl_update,
60#ifdef CONFIG_FTRACE_SELFTEST
61 .selftest = trace_selftest_startup_nop,
62#endif
63};
64
65__init static int init_nop_trace(void)
66{
67 return register_tracer(&nop_trace);
68}
69device_initcall(init_nop_trace);