DPDK 22.11.5
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 __cplusplus
9extern "C" {
10#endif
11
12#ifdef _RTE_TRACE_POINT_H_
13#error for registration, include this file first before <rte_trace_point.h>
14#endif
15
16#include <rte_per_lcore.h>
17#include <rte_trace_point.h>
18
19RTE_DECLARE_PER_LCORE(volatile int, trace_point_sz);
20
21#define RTE_TRACE_POINT_REGISTER(trace, name) \
22rte_trace_point_t __attribute__((section("__rte_trace_point"))) __##trace; \
23static const char __##trace##_name[] = RTE_STR(name); \
24RTE_INIT(trace##_init) \
25{ \
26 __rte_trace_point_register(&__##trace, __##trace##_name, \
27 (void (*)(void)) trace); \
28}
29
30#define __rte_trace_point_emit_header_generic(t) \
31 RTE_PER_LCORE(trace_point_sz) = __RTE_TRACE_EVENT_HEADER_SZ
32
33#define __rte_trace_point_emit_header_fp(t) \
34 __rte_trace_point_emit_header_generic(t)
35
36#define __rte_trace_point_emit(in, type) \
37do { \
38 RTE_BUILD_BUG_ON(sizeof(type) != sizeof(typeof(in))); \
39 __rte_trace_point_emit_field(sizeof(type), RTE_STR(in), \
40 RTE_STR(type)); \
41} while (0)
42
43#define rte_trace_point_emit_string(in) \
44do { \
45 RTE_SET_USED(in); \
46 __rte_trace_point_emit_field(__RTE_TRACE_EMIT_STRING_LEN_MAX, \
47 RTE_STR(in)"[32]", "string_bounded_t"); \
48} while (0)
49
50#ifdef __cplusplus
51}
52#endif
53
54#endif /* _RTE_TRACE_POINT_REGISTER_H_ */
#define RTE_DECLARE_PER_LCORE(type, name)
Definition: rte_per_lcore.h:38