xref: /linux/include/linux/trace.h (revision 2d6425af61166e026e7476db64f70f1266127b1d)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
2478409ddSChunyan Zhang #ifndef _LINUX_TRACE_H
3478409ddSChunyan Zhang #define _LINUX_TRACE_H
4478409ddSChunyan Zhang 
5478409ddSChunyan Zhang #ifdef CONFIG_TRACING
6478409ddSChunyan Zhang /*
7478409ddSChunyan Zhang  * The trace export - an export of Ftrace output. The trace_export
8478409ddSChunyan Zhang  * can process traces and export them to a registered destination as
9478409ddSChunyan Zhang  * an addition to the current only output of Ftrace - i.e. ring buffer.
10478409ddSChunyan Zhang  *
11478409ddSChunyan Zhang  * If you want traces to be sent to some other place rather than ring
12478409ddSChunyan Zhang  * buffer only, just need to register a new trace_export and implement
13478409ddSChunyan Zhang  * its own .write() function for writing traces to the storage.
14478409ddSChunyan Zhang  *
15478409ddSChunyan Zhang  * next		- pointer to the next trace_export
16478409ddSChunyan Zhang  * write	- copy traces which have been delt with ->commit() to
17478409ddSChunyan Zhang  *		  the destination
18478409ddSChunyan Zhang  */
19478409ddSChunyan Zhang struct trace_export {
20478409ddSChunyan Zhang 	struct trace_export __rcu	*next;
21a773d419SFelipe Balbi 	void (*write)(struct trace_export *, const void *, unsigned int);
22478409ddSChunyan Zhang };
23478409ddSChunyan Zhang 
24478409ddSChunyan Zhang int register_ftrace_export(struct trace_export *export);
25478409ddSChunyan Zhang int unregister_ftrace_export(struct trace_export *export);
26478409ddSChunyan Zhang 
27*2d6425afSDivya Indi struct trace_array;
28*2d6425afSDivya Indi 
29*2d6425afSDivya Indi void trace_printk_init_buffers(void);
30*2d6425afSDivya Indi int trace_array_printk(struct trace_array *tr, unsigned long ip,
31*2d6425afSDivya Indi 		const char *fmt, ...);
32*2d6425afSDivya Indi struct trace_array *trace_array_create(const char *name);
33*2d6425afSDivya Indi int trace_array_destroy(struct trace_array *tr);
34478409ddSChunyan Zhang #endif	/* CONFIG_TRACING */
35478409ddSChunyan Zhang 
36478409ddSChunyan Zhang #endif	/* _LINUX_TRACE_H */
37