trace_nop.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * nop tracer
  3. *
  4. * Copyright (C) 2008 Steven Noonan <steven@uplinklabs.net>
  5. *
  6. */
  7. #include <linux/module.h>
  8. #include <linux/fs.h>
  9. #include <linux/debugfs.h>
  10. #include <linux/ftrace.h>
  11. #include "trace.h"
  12. static struct trace_array *ctx_trace;
  13. static void start_nop_trace(struct trace_array *tr)
  14. {
  15. /* Nothing to do! */
  16. }
  17. static void stop_nop_trace(struct trace_array *tr)
  18. {
  19. /* Nothing to do! */
  20. }
  21. static void nop_trace_init(struct trace_array *tr)
  22. {
  23. int cpu;
  24. ctx_trace = tr;
  25. for_each_online_cpu(cpu)
  26. tracing_reset(tr, cpu);
  27. if (tr->ctrl)
  28. start_nop_trace(tr);
  29. }
  30. static void nop_trace_reset(struct trace_array *tr)
  31. {
  32. if (tr->ctrl)
  33. stop_nop_trace(tr);
  34. }
  35. static void nop_trace_ctrl_update(struct trace_array *tr)
  36. {
  37. /* When starting a new trace, reset the buffers */
  38. if (tr->ctrl)
  39. start_nop_trace(tr);
  40. else
  41. stop_nop_trace(tr);
  42. }
  43. struct tracer nop_trace __read_mostly =
  44. {
  45. .name = "nop",
  46. .init = nop_trace_init,
  47. .reset = nop_trace_reset,
  48. .ctrl_update = nop_trace_ctrl_update,
  49. #ifdef CONFIG_FTRACE_SELFTEST
  50. .selftest = trace_selftest_startup_nop,
  51. #endif
  52. };