Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Chunyan Zhang | 478409d | 2016-11-21 15:57:18 +0800 | [diff] [blame] | 2 | #ifndef _LINUX_TRACE_H |
| 3 | #define _LINUX_TRACE_H |
| 4 | |
| 5 | #ifdef CONFIG_TRACING |
Tingwei Zhang | d853627 | 2020-07-22 15:42:52 +0800 | [diff] [blame] | 6 | |
| 7 | #define TRACE_EXPORT_FUNCTION BIT(0) |
Tingwei Zhang | 23e1124 | 2020-07-22 18:22:47 +0800 | [diff] [blame] | 8 | #define TRACE_EXPORT_EVENT BIT(1) |
Tingwei Zhang | b0b6463 | 2020-07-22 18:44:32 +0800 | [diff] [blame] | 9 | #define TRACE_EXPORT_MARKER BIT(2) |
Tingwei Zhang | d853627 | 2020-07-22 15:42:52 +0800 | [diff] [blame] | 10 | |
Chunyan Zhang | 478409d | 2016-11-21 15:57:18 +0800 | [diff] [blame] | 11 | /* |
| 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 Zhang | d853627 | 2020-07-22 15:42:52 +0800 | [diff] [blame] | 23 | * flags - which ftrace to be exported |
Chunyan Zhang | 478409d | 2016-11-21 15:57:18 +0800 | [diff] [blame] | 24 | */ |
| 25 | struct trace_export { |
| 26 | struct trace_export __rcu *next; |
Felipe Balbi | a773d41 | 2017-06-02 13:20:25 +0300 | [diff] [blame] | 27 | void (*write)(struct trace_export *, const void *, unsigned int); |
Tingwei Zhang | d853627 | 2020-07-22 15:42:52 +0800 | [diff] [blame] | 28 | int flags; |
Chunyan Zhang | 478409d | 2016-11-21 15:57:18 +0800 | [diff] [blame] | 29 | }; |
| 30 | |
| 31 | int register_ftrace_export(struct trace_export *export); |
| 32 | int unregister_ftrace_export(struct trace_export *export); |
| 33 | |
Divya Indi | 2d6425a | 2019-08-14 10:55:23 -0700 | [diff] [blame] | 34 | struct trace_array; |
| 35 | |
| 36 | void trace_printk_init_buffers(void); |
| 37 | int trace_array_printk(struct trace_array *tr, unsigned long ip, |
| 38 | const char *fmt, ...); |
Steven Rostedt (VMware) | 38ce2a9 | 2020-08-06 12:46:49 -0400 | [diff] [blame] | 39 | int trace_array_init_printk(struct trace_array *tr); |
Divya Indi | 2887978 | 2019-11-20 11:08:38 -0800 | [diff] [blame] | 40 | void trace_array_put(struct trace_array *tr); |
| 41 | struct trace_array *trace_array_get_by_name(const char *name); |
Divya Indi | 2d6425a | 2019-08-14 10:55:23 -0700 | [diff] [blame] | 42 | int trace_array_destroy(struct trace_array *tr); |
Chunyan Zhang | 478409d | 2016-11-21 15:57:18 +0800 | [diff] [blame] | 43 | #endif /* CONFIG_TRACING */ |
| 44 | |
| 45 | #endif /* _LINUX_TRACE_H */ |