rte_spinlock_unlock(&trace->lock);
}
+void
+__rte_trace_point_emit_field(size_t sz, const char *in, const char *datatype)
+{
+ char *field = RTE_PER_LCORE(ctf_field);
+ int count = RTE_PER_LCORE(ctf_count);
+ size_t size;
+ int rc;
+
+ size = RTE_MAX(0, TRACE_CTF_FIELD_SIZE - 1 - count);
+ RTE_PER_LCORE(trace_point_sz) += sz;
+ rc = snprintf(RTE_PTR_ADD(field, count), size, "%s %s;", datatype, in);
+ if (rc <= 0 || (size_t)rc >= size) {
+ RTE_PER_LCORE(trace_point_sz) = 0;
+ trace_crit("CTF field is too long");
+ return;
+ }
+ RTE_PER_LCORE(ctf_count) += rc;
+}
+
int
__rte_trace_point_register(rte_trace_point_t *handle, const char *name,
void (*register_fn)(void))
__rte_experimental
void __rte_trace_mem_per_thread_alloc(void);
+/**
+ * @internal
+ *
+ * Helper function to emit field.
+ *
+ * @param sz
+ * The tracepoint size.
+ * @param field
+ * The name of the trace event.
+ * @param type
+ * The datatype of the trace event as string.
+ * @return
+ * - 0: Success.
+ * - <0: Failure.
+ */
+__rte_experimental
+void __rte_trace_point_emit_field(size_t sz, const char *field,
+ const char *type);
+
/**
* @internal
*
__rte_trace_point_register(&__##trace, RTE_STR(name), \
(void (*)(void)) trace)
+#define __rte_trace_point_emit_header_generic(t) \
+ RTE_PER_LCORE(trace_point_sz) = __RTE_TRACE_EVENT_HEADER_SZ
+
+#define __rte_trace_point_emit_header_fp(t) \
+ __rte_trace_point_emit_header_generic(t)
+
+#define __rte_trace_point_emit(in, type) \
+do { \
+ RTE_BUILD_BUG_ON(sizeof(type) != sizeof(typeof(in))); \
+ __rte_trace_point_emit_field(sizeof(type), RTE_STR(in), \
+ RTE_STR(type)); \
+} while (0)
+
+#define rte_trace_point_emit_string(in) \
+do { \
+ RTE_SET_USED(in); \
+ __rte_trace_point_emit_field(__RTE_TRACE_EMIT_STRING_LEN_MAX, \
+ RTE_STR(in)"[32]", "string_bounded_t"); \
+} while (0)
+
#endif /* _RTE_TRACE_POINT_REGISTER_H_ */
# added in 20.05
__rte_trace_mem_per_thread_alloc;
+ __rte_trace_point_emit_field;
__rte_trace_point_register;
per_lcore_trace_mem;
per_lcore_trace_point_sz;