Provide an alternate RTE_TRACE_POINT_REGISTER macro when building with
MSVC that allocates segments for the trace point using MSVC specific
features

Signed-off-by: Tyler Retzlaff <roret...@linux.microsoft.com>
---
 lib/eal/include/rte_trace_point_register.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/lib/eal/include/rte_trace_point_register.h 
b/lib/eal/include/rte_trace_point_register.h
index a9682d3..e6c2abe 100644
--- a/lib/eal/include/rte_trace_point_register.h
+++ b/lib/eal/include/rte_trace_point_register.h
@@ -18,6 +18,19 @@
 
 RTE_DECLARE_PER_LCORE(volatile int, trace_point_sz);
 
+#ifdef RTE_TOOLCHAIN_MSVC
+#define RTE_TRACE_POINT_REGISTER(trace, name) \
+rte_trace_point_t \
+__pragma(data_seg("__rte_trace_point")) \
+__declspec(allocate("__rte_trace_point")) \
+__##trace; \
+static const char __##trace##_name[] = RTE_STR(name); \
+RTE_INIT(trace##_init) \
+{ \
+       __rte_trace_point_register(&__##trace, __##trace##_name, \
+               (void (*)(void)) trace); \
+}
+#else
 #define RTE_TRACE_POINT_REGISTER(trace, name) \
 rte_trace_point_t __attribute__((section("__rte_trace_point"))) __##trace; \
 static const char __##trace##_name[] = RTE_STR(name); \
@@ -26,6 +39,7 @@
        __rte_trace_point_register(&__##trace, __##trace##_name, \
                (void (*)(void)) trace); \
 }
+#endif
 
 #define __rte_trace_point_emit_header_generic(t) \
        RTE_PER_LCORE(trace_point_sz) = __RTE_TRACE_EVENT_HEADER_SZ
-- 
1.8.3.1

Reply via email to