blob: 886a4ffd9d45de42bebac10909608f8865855151 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Chunyan Zhang478409d2016-11-21 15:57:18 +08002#ifndef _LINUX_TRACE_H
3#define _LINUX_TRACE_H
4
5#ifdef CONFIG_TRACING
Tingwei Zhangd8536272020-07-22 15:42:52 +08006
7#define TRACE_EXPORT_FUNCTION BIT(0)
Tingwei Zhang23e11242020-07-22 18:22:47 +08008#define TRACE_EXPORT_EVENT BIT(1)
Tingwei Zhangb0b64632020-07-22 18:44:32 +08009#define TRACE_EXPORT_MARKER BIT(2)
Tingwei Zhangd8536272020-07-22 15:42:52 +080010
Chunyan Zhang478409d2016-11-21 15:57:18 +080011/*
12 * The trace export - an export of Ftrace output. The trace_export
13 * can process traces and export them to a registered destination as
14 * an addition to the current only output of Ftrace - i.e. ring buffer.
15 *
16 * If you want traces to be sent to some other place rather than ring
17 * buffer only, just need to register a new trace_export and implement
18 * its own .write() function for writing traces to the storage.
19 *
20 * next - pointer to the next trace_export
21 * write - copy traces which have been delt with ->commit() to
22 * the destination
Tingwei Zhangd8536272020-07-22 15:42:52 +080023 * flags - which ftrace to be exported
Chunyan Zhang478409d2016-11-21 15:57:18 +080024 */
25struct trace_export {
26 struct trace_export __rcu *next;
Felipe Balbia773d412017-06-02 13:20:25 +030027 void (*write)(struct trace_export *, const void *, unsigned int);
Tingwei Zhangd8536272020-07-22 15:42:52 +080028 int flags;
Chunyan Zhang478409d2016-11-21 15:57:18 +080029};
30
31int register_ftrace_export(struct trace_export *export);
32int unregister_ftrace_export(struct trace_export *export);
33
Divya Indi2d6425a2019-08-14 10:55:23 -070034struct trace_array;
35
36void trace_printk_init_buffers(void);
37int trace_array_printk(struct trace_array *tr, unsigned long ip,
38 const char *fmt, ...);
Steven Rostedt (VMware)38ce2a92020-08-06 12:46:49 -040039int trace_array_init_printk(struct trace_array *tr);
Divya Indi28879782019-11-20 11:08:38 -080040void trace_array_put(struct trace_array *tr);
41struct trace_array *trace_array_get_by_name(const char *name);
Divya Indi2d6425a2019-08-14 10:55:23 -070042int trace_array_destroy(struct trace_array *tr);
Chunyan Zhang478409d2016-11-21 15:57:18 +080043#endif /* CONFIG_TRACING */
44
45#endif /* _LINUX_TRACE_H */