Steven Noonan | fb1b6d8 | 2008-09-19 03:06:43 -0700 | [diff] [blame^] | 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); |