trace.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _LINUX_TRACE_H
  3. #define _LINUX_TRACE_H
  4. #ifdef CONFIG_TRACING
  5. #define TRACE_EXPORT_FUNCTION BIT(0)
  6. #define TRACE_EXPORT_EVENT BIT(1)
  7. #define TRACE_EXPORT_MARKER BIT(2)
  8. /*
  9. * The trace export - an export of Ftrace output. The trace_export
  10. * can process traces and export them to a registered destination as
  11. * an addition to the current only output of Ftrace - i.e. ring buffer.
  12. *
  13. * If you want traces to be sent to some other place rather than ring
  14. * buffer only, just need to register a new trace_export and implement
  15. * its own .write() function for writing traces to the storage.
  16. *
  17. * next - pointer to the next trace_export
  18. * write - copy traces which have been delt with ->commit() to
  19. * the destination
  20. * flags - which ftrace to be exported
  21. */
  22. struct trace_export {
  23. struct trace_export __rcu *next;
  24. void (*write)(struct trace_export *, const void *, unsigned int);
  25. int flags;
  26. };
  27. int register_ftrace_export(struct trace_export *export);
  28. int unregister_ftrace_export(struct trace_export *export);
  29. struct trace_array;
  30. void trace_printk_init_buffers(void);
  31. int trace_array_printk(struct trace_array *tr, unsigned long ip,
  32. const char *fmt, ...);
  33. int trace_array_init_printk(struct trace_array *tr);
  34. void trace_array_put(struct trace_array *tr);
  35. struct trace_array *trace_array_get_by_name(const char *name);
  36. int trace_array_destroy(struct trace_array *tr);
  37. #endif /* CONFIG_TRACING */
  38. #endif /* _LINUX_TRACE_H */