5#ifndef _RTE_TRACE_POINT_H_
6#define _RTE_TRACE_POINT_H_
28#include <rte_compat.h>
42#define RTE_TRACE_POINT_ARGS
45#define __RTE_TRACE_POINT(_mode, _tp, _args, ...) \
46extern rte_trace_point_t __##_tp; \
47static __rte_always_inline void \
50 __rte_trace_point_emit_header_##_mode(&__##_tp); \
78#define RTE_TRACE_POINT(tp, args, ...) \
79 __RTE_TRACE_POINT(generic, tp, args, __VA_ARGS__)
99#define RTE_TRACE_POINT_FP(tp, args, ...) \
100 __RTE_TRACE_POINT(fp, tp, args, __VA_ARGS__)
115#define RTE_TRACE_POINT_REGISTER(trace, name)
118#define rte_trace_point_emit_u64(val)
120#define rte_trace_point_emit_i64(val)
122#define rte_trace_point_emit_u32(val)
124#define rte_trace_point_emit_i32(val)
126#define rte_trace_point_emit_u16(val)
128#define rte_trace_point_emit_i16(val)
130#define rte_trace_point_emit_u8(val)
132#define rte_trace_point_emit_i8(val)
134#define rte_trace_point_emit_int(val)
136#define rte_trace_point_emit_long(val)
138#define rte_trace_point_emit_size_t(val)
140#define rte_trace_point_emit_float(val)
142#define rte_trace_point_emit_double(val)
144#define rte_trace_point_emit_ptr(val)
146#define rte_trace_point_emit_string(val)
151#define __RTE_TRACE_EMIT_STRING_LEN_MAX 32
153#define __RTE_TRACE_EVENT_HEADER_SZ sizeof(uint64_t)
211__rte_trace_point_fp_is_enabled(
void)
213#ifdef RTE_ENABLE_TRACE_FP
227void __rte_trace_mem_per_thread_alloc(
void);
245void __rte_trace_point_emit_field(
size_t sz,
const char *field,
266 void (*register_fn)(
void));
270#ifndef _RTE_TRACE_POINT_REGISTER_H_
271#ifdef ALLOW_EXPERIMENTAL_API
273#define __RTE_TRACE_EVENT_HEADER_ID_SHIFT (48)
275#define __RTE_TRACE_FIELD_SIZE_SHIFT 0
276#define __RTE_TRACE_FIELD_SIZE_MASK (0xffffULL << __RTE_TRACE_FIELD_SIZE_SHIFT)
277#define __RTE_TRACE_FIELD_ID_SHIFT (16)
278#define __RTE_TRACE_FIELD_ID_MASK (0xffffULL << __RTE_TRACE_FIELD_ID_SHIFT)
279#define __RTE_TRACE_FIELD_ENABLE_MASK (1ULL << 63)
280#define __RTE_TRACE_FIELD_ENABLE_DISCARD (1ULL << 62)
282struct __rte_trace_stream_header {
286 char thread_name[__RTE_TRACE_EMIT_STRING_LEN_MAX];
289struct __rte_trace_header {
292 struct __rte_trace_stream_header stream_header;
299__rte_trace_mem_get(uint64_t in)
301 struct __rte_trace_header *trace =
303 const uint16_t sz = in & __RTE_TRACE_FIELD_SIZE_MASK;
307 __rte_trace_mem_per_thread_alloc();
308 trace = (
struct __rte_trace_header *)(
RTE_PER_LCORE(trace_mem));
313 uint32_t offset = trace->offset;
314 if (
unlikely((offset + sz) >= trace->len)) {
316 if (
unlikely(in & __RTE_TRACE_FIELD_ENABLE_DISCARD))
325 trace->offset = offset;
331__rte_trace_point_emit_ev_header(
void *mem, uint64_t in)
337 ~(0xffffULL << __RTE_TRACE_EVENT_HEADER_ID_SHIFT);
338 val |= ((in & __RTE_TRACE_FIELD_ID_MASK) <<
339 (__RTE_TRACE_EVENT_HEADER_ID_SHIFT -
340 __RTE_TRACE_FIELD_ID_SHIFT));
342 *(uint64_t *)mem = val;
343 return RTE_PTR_ADD(mem, __RTE_TRACE_EVENT_HEADER_SZ);
346#define __rte_trace_point_emit_header_generic(t) \
349 const uint64_t val = __atomic_load_n(t, __ATOMIC_ACQUIRE); \
350 if (likely(!(val & __RTE_TRACE_FIELD_ENABLE_MASK))) \
352 mem = __rte_trace_mem_get(val); \
353 if (unlikely(mem == NULL)) \
355 mem = __rte_trace_point_emit_ev_header(mem, val); \
358#define __rte_trace_point_emit_header_fp(t) \
359 if (!__rte_trace_point_fp_is_enabled()) \
361 __rte_trace_point_emit_header_generic(t)
363#define __rte_trace_point_emit(in, type) \
365 memcpy(mem, &(in), sizeof(in)); \
366 mem = RTE_PTR_ADD(mem, sizeof(in)); \
369#define rte_trace_point_emit_string(in) \
371 if (unlikely(in == NULL)) \
373 rte_strscpy((char *)mem, in, __RTE_TRACE_EMIT_STRING_LEN_MAX); \
374 mem = RTE_PTR_ADD(mem, __RTE_TRACE_EMIT_STRING_LEN_MAX); \
379#define __rte_trace_point_emit_header_generic(t) RTE_SET_USED(t)
380#define __rte_trace_point_emit_header_fp(t) RTE_SET_USED(t)
381#define __rte_trace_point_emit(in, type) RTE_SET_USED(in)
382#define rte_trace_point_emit_string(in) RTE_SET_USED(in)
387#define rte_trace_point_emit_u64(in) __rte_trace_point_emit(in, uint64_t)
388#define rte_trace_point_emit_i64(in) __rte_trace_point_emit(in, int64_t)
389#define rte_trace_point_emit_u32(in) __rte_trace_point_emit(in, uint32_t)
390#define rte_trace_point_emit_i32(in) __rte_trace_point_emit(in, int32_t)
391#define rte_trace_point_emit_u16(in) __rte_trace_point_emit(in, uint16_t)
392#define rte_trace_point_emit_i16(in) __rte_trace_point_emit(in, int16_t)
393#define rte_trace_point_emit_u8(in) __rte_trace_point_emit(in, uint8_t)
394#define rte_trace_point_emit_i8(in) __rte_trace_point_emit(in, int8_t)
395#define rte_trace_point_emit_int(in) __rte_trace_point_emit(in, int32_t)
396#define rte_trace_point_emit_long(in) __rte_trace_point_emit(in, long)
397#define rte_trace_point_emit_size_t(in) __rte_trace_point_emit(in, size_t)
398#define rte_trace_point_emit_float(in) __rte_trace_point_emit(in, float)
399#define rte_trace_point_emit_double(in) __rte_trace_point_emit(in, double)
400#define rte_trace_point_emit_ptr(in) __rte_trace_point_emit(in, uintptr_t)
#define RTE_ALIGN_CEIL(val, align)
#define RTE_PTR_ADD(ptr, x)
#define __rte_always_inline
static uint64_t rte_get_tsc_cycles(void)
#define RTE_PER_LCORE(name)
#define RTE_DECLARE_PER_LCORE(type, name)
uint64_t rte_trace_point_t
__rte_experimental bool rte_trace_point_is_enabled(rte_trace_point_t *tp)
__rte_experimental int rte_trace_point_disable(rte_trace_point_t *tp)
__rte_experimental int rte_trace_point_enable(rte_trace_point_t *tp)
__rte_experimental rte_trace_point_t * rte_trace_point_lookup(const char *name)
unsigned char rte_uuid_t[16]