1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(C) 2020 Marvell International Ltd.
13 * This file provides the trace API to RTE applications.
16 * @b EXPERIMENTAL: this API may change without prior notice
26 #include <rte_common.h>
27 #include <rte_compat.h>
30 * Test if trace is enabled.
33 * true if trace is enabled, false otherwise.
36 bool rte_trace_is_enabled(void);
39 * Enumerate trace mode operation.
43 * In this mode, when no space is left in the trace buffer, the
44 * subsequent events overwrite the old events.
46 RTE_TRACE_MODE_OVERWRITE,
48 * In this mode, when no space is left in the trace buffer, the
49 * subsequent events shall not be recorded.
51 RTE_TRACE_MODE_DISCARD,
61 void rte_trace_mode_set(enum rte_trace_mode mode);
67 * The current trace mode.
70 enum rte_trace_mode rte_trace_mode_get(void);
73 * Enable/Disable a set of tracepoints based on globbing pattern.
76 * The globbing pattern identifying the tracepoint.
78 * true to enable tracepoint, false to disable the tracepoint, upon match.
80 * - 0: Success and no pattern match.
81 * - 1: Success and found pattern match.
82 * - (-ERANGE): Tracepoint object is not registered.
85 int rte_trace_pattern(const char *pattern, bool enable);
88 * Enable/Disable a set of tracepoints based on regular expression.
91 * A regular expression identifying the tracepoint.
93 * true to enable tracepoint, false to disable the tracepoint, upon match.
95 * - 0: Success and no pattern match.
96 * - 1: Success and found pattern match.
97 * - (-ERANGE): Tracepoint object is not registered.
98 * - (-EINVAL): Invalid regular expression rule.
101 int rte_trace_regexp(const char *regex, bool enable);
104 * Save the trace buffer to the trace directory.
106 * By default, trace directory will be created at $HOME directory and this can
107 * be overridden by --trace-dir EAL parameter.
114 int rte_trace_save(void);
117 * Dump the trace metadata to a file.
120 * A pointer to a file for output
126 int rte_trace_metadata_dump(FILE *f);
129 * Dump the trace subsystem status to a file.
132 * A pointer to a file for output
135 void rte_trace_dump(FILE *f);
141 #endif /* _RTE_TRACE_H_ */