1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(C) 2020 Marvell International Ltd.
8 #include <rte_cycles.h>
9 #include <rte_spinlock.h>
10 #include <rte_trace.h>
11 #include <rte_trace_point.h>
14 #define trace_err(fmt, args...) \
15 RTE_LOG(ERR, EAL, "%s():%u " fmt "\n", __func__, __LINE__, ## args)
17 #define trace_crit(fmt, args...) \
18 RTE_LOG(CRIT, EAL, "%s():%u " fmt "\n", __func__, __LINE__, ## args)
20 #define TRACE_PREFIX_LEN 12
21 #define TRACE_DIR_STR_LEN (sizeof("YYYY-mm-dd-AM-HH-MM-SS") + TRACE_PREFIX_LEN)
22 #define TRACE_CTF_FIELD_SIZE 384
23 #define TRACE_POINT_NAME_SIZE 64
26 STAILQ_ENTRY(trace_point) next;
27 rte_trace_point_t *handle;
28 char name[TRACE_POINT_NAME_SIZE];
29 char ctf_field[TRACE_CTF_FIELD_SIZE];
37 enum rte_trace_mode mode;
40 uint32_t nb_trace_points;
43 uint64_t uptime_ticks;
45 uint32_t ctf_meta_offset_freq;
46 uint32_t ctf_meta_offset_freq_off_s;
47 uint32_t ctf_meta_offset_freq_off;
48 uint16_t ctf_fixup_done;
52 /* Helper functions */
53 static inline uint16_t
54 trace_id_get(rte_trace_point_t *trace)
56 return (*trace & __RTE_TRACE_FIELD_ID_MASK) >>
57 __RTE_TRACE_FIELD_ID_SHIFT;
60 /* Trace object functions */
61 struct trace *trace_obj_get(void);
63 /* Trace point list functions */
64 STAILQ_HEAD(trace_point_head, trace_point);
65 struct trace_point_head *trace_list_head_get(void);
68 bool trace_has_duplicate_entry(void);
69 void trace_uuid_generate(void);
70 int trace_metadata_create(void);
71 void trace_metadata_destroy(void);
72 int trace_mkdir(void);
73 int trace_epoch_time_save(void);
76 int eal_trace_init(void);
77 void eal_trace_fini(void);
79 #endif /* __EAL_TRACE_H */