blob: 886a4ffd9d45de42bebac10909608f8865855151 [file] [log] [blame]
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00001/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _LINUX_TRACE_H
3#define _LINUX_TRACE_H
4
5#ifdef CONFIG_TRACING
Olivier Deprez157378f2022-04-04 15:47:50 +02006
7#define TRACE_EXPORT_FUNCTION BIT(0)
8#define TRACE_EXPORT_EVENT BIT(1)
9#define TRACE_EXPORT_MARKER BIT(2)
10
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000011/*
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
Olivier Deprez157378f2022-04-04 15:47:50 +020023 * flags - which ftrace to be exported
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000024 */
25struct trace_export {
26 struct trace_export __rcu *next;
27 void (*write)(struct trace_export *, const void *, unsigned int);
Olivier Deprez157378f2022-04-04 15:47:50 +020028 int flags;
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000029};
30
31int register_ftrace_export(struct trace_export *export);
32int unregister_ftrace_export(struct trace_export *export);
33
Olivier Deprez157378f2022-04-04 15:47:50 +020034struct trace_array;
35
36void trace_printk_init_buffers(void);
37int trace_array_printk(struct trace_array *tr, unsigned long ip,
38 const char *fmt, ...);
39int trace_array_init_printk(struct trace_array *tr);
40void trace_array_put(struct trace_array *tr);
41struct trace_array *trace_array_get_by_name(const char *name);
42int trace_array_destroy(struct trace_array *tr);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000043#endif /* CONFIG_TRACING */
44
45#endif /* _LINUX_TRACE_H */