Loading...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | /* SPDX-License-Identifier: BSD-3-Clause * Copyright(C) 2020 Marvell International Ltd. */ #ifndef _RTE_TRACE_H_ #define _RTE_TRACE_H_ /** * @file * * RTE Trace API * * This file provides the trace API to RTE applications. * * @warning * @b EXPERIMENTAL: this API may change without prior notice */ #ifdef __cplusplus extern "C" { #endif #include <stdbool.h> #include <stdio.h> #include <rte_common.h> #include <rte_compat.h> /** * Test if trace is enabled. * * @return * true if trace is enabled, false otherwise. */ __rte_experimental bool rte_trace_is_enabled(void); /** * Enumerate trace mode operation. */ enum rte_trace_mode { /** * In this mode, when no space is left in the trace buffer, the * subsequent events overwrite the old events. */ RTE_TRACE_MODE_OVERWRITE, /** * In this mode, when no space is left in the trace buffer, the * subsequent events shall not be recorded. */ RTE_TRACE_MODE_DISCARD, }; /** * Set the trace mode. * * @param mode * Trace mode. */ __rte_experimental void rte_trace_mode_set(enum rte_trace_mode mode); /** * Get the trace mode. * * @return * The current trace mode. */ __rte_experimental enum rte_trace_mode rte_trace_mode_get(void); /** * Enable/Disable a set of tracepoints based on globbing pattern. * * @param pattern * The globbing pattern identifying the tracepoint. * @param enable * true to enable tracepoint, false to disable the tracepoint, upon match. * @return * - 0: Success and no pattern match. * - 1: Success and found pattern match. * - (-ERANGE): Tracepoint object is not registered. */ __rte_experimental int rte_trace_pattern(const char *pattern, bool enable); /** * Enable/Disable a set of tracepoints based on regular expression. * * @param regex * A regular expression identifying the tracepoint. * @param enable * true to enable tracepoint, false to disable the tracepoint, upon match. * @return * - 0: Success and no pattern match. * - 1: Success and found pattern match. * - (-ERANGE): Tracepoint object is not registered. * - (-EINVAL): Invalid regular expression rule. */ __rte_experimental int rte_trace_regexp(const char *regex, bool enable); /** * Save the trace buffer to the trace directory. * * By default, trace directory will be created at $HOME directory and this can * be overridden by --trace-dir EAL parameter. * * @return * - 0: Success. * - <0 : Failure. */ __rte_experimental int rte_trace_save(void); /** * Dump the trace metadata to a file. * * @param f * A pointer to a file for output * @return * - 0: Success. * - <0 : Failure. */ __rte_experimental int rte_trace_metadata_dump(FILE *f); /** * Dump the trace subsystem status to a file. * * @param f * A pointer to a file for output */ __rte_experimental void rte_trace_dump(FILE *f); #ifdef __cplusplus } #endif #endif /* _RTE_TRACE_H_ */ |