DPDK  20.05.0
rte_trace_point_register.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(C) 2020 Marvell International Ltd.
3  */
4 
5 #ifndef _RTE_TRACE_POINT_REGISTER_H_
6 #define _RTE_TRACE_POINT_REGISTER_H_
7 
8 #ifdef _RTE_TRACE_POINT_H_
9 #error for registration, include this file first before <rte_trace_point.h>
10 #endif
11 
12 #include <rte_per_lcore.h>
13 #include <rte_trace_point.h>
14 
15 RTE_DECLARE_PER_LCORE(volatile int, trace_point_sz);
16 
17 #define RTE_TRACE_POINT_REGISTER(trace, name) \
18  __rte_trace_point_register(&__##trace, RTE_STR(name), \
19  (void (*)(void)) trace)
20 
21 #define __rte_trace_point_emit_header_generic(t) \
22  RTE_PER_LCORE(trace_point_sz) = __RTE_TRACE_EVENT_HEADER_SZ
23 
24 #define __rte_trace_point_emit_header_fp(t) \
25  __rte_trace_point_emit_header_generic(t)
26 
27 #define __rte_trace_point_emit(in, type) \
28 do { \
29  RTE_BUILD_BUG_ON(sizeof(type) != sizeof(typeof(in))); \
30  __rte_trace_point_emit_field(sizeof(type), RTE_STR(in), \
31  RTE_STR(type)); \
32 } while (0)
33 
34 #define rte_trace_point_emit_string(in) \
35 do { \
36  RTE_SET_USED(in); \
37  __rte_trace_point_emit_field(__RTE_TRACE_EMIT_STRING_LEN_MAX, \
38  RTE_STR(in)"[32]", "string_bounded_t"); \
39 } while (0)
40 
41 #endif /* _RTE_TRACE_POINT_REGISTER_H_ */
#define RTE_DECLARE_PER_LCORE(type, name)
Definition: rte_per_lcore.h:38