trace: add generic tracepoints
authorJerin Jacob <jerinj@marvell.com>
Wed, 22 Apr 2020 19:03:33 +0000 (00:33 +0530)
committerDavid Marchand <david.marchand@redhat.com>
Thu, 23 Apr 2020 13:39:42 +0000 (15:39 +0200)
This patch creates the following generic tracepoint for
generic tracing when there is no dedicated tracepoint is
available.

- rte_eal_trace_generic_void()
- rte_eal_trace_generic_u64()
- rte_eal_trace_generic_u32()
- rte_eal_trace_generic_u16()
- rte_eal_trace_generic_u8()
- rte_eal_trace_generic_i64()
- rte_eal_trace_generic_i32()
- rte_eal_trace_generic_i16()
- rte_eal_trace_generic_i8()
- rte_eal_trace_generic_int()
- rte_eal_trace_generic_long()
- rte_eal_trace_generic_float()
- rte_eal_trace_generic_double()
- rte_eal_trace_generic_ptr()
- rte_eal_trace_generic_str()

For example, if an application wishes to emit an int datatype,
it can call rte_eal_trace_generic_int(val) to emit the trace.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
lib/librte_eal/common/eal_common_trace_points.c [new file with mode: 0644]
lib/librte_eal/common/meson.build
lib/librte_eal/freebsd/Makefile
lib/librte_eal/include/meson.build
lib/librte_eal/include/rte_eal_trace.h [new file with mode: 0644]
lib/librte_eal/linux/Makefile
lib/librte_eal/rte_eal_version.map

diff --git a/lib/librte_eal/common/eal_common_trace_points.c b/lib/librte_eal/common/eal_common_trace_points.c
new file mode 100644 (file)
index 0000000..29776a3
--- /dev/null
@@ -0,0 +1,60 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2020 Marvell International Ltd.
+ */
+
+#define RTE_TRACE_POINT_REGISTER_SELECT
+
+#include <rte_eal_trace.h>
+
+RTE_TRACE_POINT_DEFINE(rte_eal_trace_generic_void);
+RTE_TRACE_POINT_DEFINE(rte_eal_trace_generic_u64);
+RTE_TRACE_POINT_DEFINE(rte_eal_trace_generic_u32);
+RTE_TRACE_POINT_DEFINE(rte_eal_trace_generic_u16);
+RTE_TRACE_POINT_DEFINE(rte_eal_trace_generic_u8);
+RTE_TRACE_POINT_DEFINE(rte_eal_trace_generic_i64);
+RTE_TRACE_POINT_DEFINE(rte_eal_trace_generic_i32);
+RTE_TRACE_POINT_DEFINE(rte_eal_trace_generic_i16);
+RTE_TRACE_POINT_DEFINE(rte_eal_trace_generic_i8);
+RTE_TRACE_POINT_DEFINE(rte_eal_trace_generic_int);
+RTE_TRACE_POINT_DEFINE(rte_eal_trace_generic_long);
+RTE_TRACE_POINT_DEFINE(rte_eal_trace_generic_float);
+RTE_TRACE_POINT_DEFINE(rte_eal_trace_generic_double);
+RTE_TRACE_POINT_DEFINE(rte_eal_trace_generic_ptr);
+RTE_TRACE_POINT_DEFINE(rte_eal_trace_generic_str);
+RTE_TRACE_POINT_DEFINE(rte_eal_trace_generic_func);
+
+RTE_INIT(eal_trace_init)
+{
+       RTE_TRACE_POINT_REGISTER(rte_eal_trace_generic_void,
+               lib.eal.generic.void);
+       RTE_TRACE_POINT_REGISTER(rte_eal_trace_generic_u64,
+               lib.eal.generic.u64);
+       RTE_TRACE_POINT_REGISTER(rte_eal_trace_generic_u32,
+               lib.eal.generic.u32);
+       RTE_TRACE_POINT_REGISTER(rte_eal_trace_generic_u16,
+               lib.eal.generic.u16);
+       RTE_TRACE_POINT_REGISTER(rte_eal_trace_generic_u8,
+               lib.eal.generic.u8);
+       RTE_TRACE_POINT_REGISTER(rte_eal_trace_generic_i64,
+               lib.eal.generic.i64);
+       RTE_TRACE_POINT_REGISTER(rte_eal_trace_generic_i32,
+               lib.eal.generic.i32);
+       RTE_TRACE_POINT_REGISTER(rte_eal_trace_generic_i16,
+               lib.eal.generic.i16);
+       RTE_TRACE_POINT_REGISTER(rte_eal_trace_generic_i8,
+               lib.eal.generic.i8);
+       RTE_TRACE_POINT_REGISTER(rte_eal_trace_generic_int,
+               lib.eal.generic.int);
+       RTE_TRACE_POINT_REGISTER(rte_eal_trace_generic_long,
+               lib.eal.generic.long);
+       RTE_TRACE_POINT_REGISTER(rte_eal_trace_generic_float,
+               lib.eal.generic.float);
+       RTE_TRACE_POINT_REGISTER(rte_eal_trace_generic_double,
+               lib.eal.generic.double);
+       RTE_TRACE_POINT_REGISTER(rte_eal_trace_generic_ptr,
+               lib.eal.generic.ptr);
+       RTE_TRACE_POINT_REGISTER(rte_eal_trace_generic_str,
+               lib.eal.generic.string);
+       RTE_TRACE_POINT_REGISTER(rte_eal_trace_generic_func,
+               lib.eal.generic.func);
+}
index d2ac443..155da29 100644 (file)
@@ -44,6 +44,7 @@ sources += files(
        'eal_common_timer.c',
        'eal_common_trace.c',
        'eal_common_trace_ctf.c',
+       'eal_common_trace_points.c',
        'eal_common_trace_utils.c',
        'eal_common_uuid.c',
        'hotplug_mp.c',
index 539ad44..a8400f2 100644 (file)
@@ -61,6 +61,7 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_FREEBSD) += eal_common_fbarray.c
 SRCS-$(CONFIG_RTE_EXEC_ENV_FREEBSD) += eal_common_uuid.c
 SRCS-$(CONFIG_RTE_EXEC_ENV_FREEBSD) += eal_common_trace.c
 SRCS-$(CONFIG_RTE_EXEC_ENV_FREEBSD) += eal_common_trace_ctf.c
+SRCS-$(CONFIG_RTE_EXEC_ENV_FREEBSD) += eal_common_trace_points.c
 SRCS-$(CONFIG_RTE_EXEC_ENV_FREEBSD) += eal_common_trace_utils.c
 SRCS-$(CONFIG_RTE_EXEC_ENV_FREEBSD) += rte_malloc.c
 SRCS-$(CONFIG_RTE_EXEC_ENV_FREEBSD) += hotplug_mp.c
index ce36061..e9537c9 100644 (file)
@@ -17,6 +17,7 @@ headers += files(
        'rte_eal.h',
        'rte_eal_interrupts.h',
        'rte_eal_memconfig.h',
+       'rte_eal_trace.h',
        'rte_errno.h',
        'rte_fbarray.h',
        'rte_hexdump.h',
diff --git a/lib/librte_eal/include/rte_eal_trace.h b/lib/librte_eal/include/rte_eal_trace.h
new file mode 100644 (file)
index 0000000..67969bf
--- /dev/null
@@ -0,0 +1,122 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2020 Marvell International Ltd.
+ */
+
+#ifndef _RTE_EAL_TRACE_H_
+#define _RTE_EAL_TRACE_H_
+
+/**
+ * @file
+ *
+ * API for EAL trace support
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_trace_point.h>
+
+/* Generic */
+RTE_TRACE_POINT(
+       rte_eal_trace_generic_void,
+       RTE_TRACE_POINT_ARGS(void),
+)
+
+RTE_TRACE_POINT(
+       rte_eal_trace_generic_u64,
+       RTE_TRACE_POINT_ARGS(uint64_t in),
+       rte_trace_point_emit_u64(in);
+)
+
+RTE_TRACE_POINT(
+       rte_eal_trace_generic_u32,
+       RTE_TRACE_POINT_ARGS(uint32_t in),
+       rte_trace_point_emit_u32(in);
+)
+
+RTE_TRACE_POINT(
+       rte_eal_trace_generic_u16,
+       RTE_TRACE_POINT_ARGS(uint16_t in),
+       rte_trace_point_emit_u16(in);
+)
+
+RTE_TRACE_POINT(
+       rte_eal_trace_generic_u8,
+       RTE_TRACE_POINT_ARGS(uint8_t in),
+       rte_trace_point_emit_u8(in);
+)
+
+RTE_TRACE_POINT(
+       rte_eal_trace_generic_i64,
+       RTE_TRACE_POINT_ARGS(int64_t in),
+       rte_trace_point_emit_i64(in);
+)
+
+RTE_TRACE_POINT(
+       rte_eal_trace_generic_i32,
+       RTE_TRACE_POINT_ARGS(int32_t in),
+       rte_trace_point_emit_i32(in);
+)
+
+RTE_TRACE_POINT(
+       rte_eal_trace_generic_i16,
+       RTE_TRACE_POINT_ARGS(int16_t in),
+       rte_trace_point_emit_i16(in);
+)
+
+RTE_TRACE_POINT(
+       rte_eal_trace_generic_i8,
+       RTE_TRACE_POINT_ARGS(int8_t in),
+       rte_trace_point_emit_i8(in);
+)
+
+RTE_TRACE_POINT(
+       rte_eal_trace_generic_int,
+       RTE_TRACE_POINT_ARGS(int in),
+       rte_trace_point_emit_int(in);
+)
+
+RTE_TRACE_POINT(
+       rte_eal_trace_generic_long,
+       RTE_TRACE_POINT_ARGS(long in),
+       rte_trace_point_emit_long(in);
+)
+
+RTE_TRACE_POINT(
+       rte_eal_trace_generic_float,
+       RTE_TRACE_POINT_ARGS(float in),
+       rte_trace_point_emit_float(in);
+)
+
+RTE_TRACE_POINT(
+       rte_eal_trace_generic_double,
+       RTE_TRACE_POINT_ARGS(double in),
+       rte_trace_point_emit_double(in);
+)
+
+RTE_TRACE_POINT(
+       rte_eal_trace_generic_ptr,
+       RTE_TRACE_POINT_ARGS(const void *ptr),
+       rte_trace_point_emit_ptr(ptr);
+)
+
+RTE_TRACE_POINT(
+       rte_eal_trace_generic_str,
+       RTE_TRACE_POINT_ARGS(const char *str),
+       rte_trace_point_emit_string(str);
+)
+
+RTE_TRACE_POINT(
+       rte_eal_trace_generic_func,
+       RTE_TRACE_POINT_ARGS(const char *func),
+       rte_trace_point_emit_string(func);
+)
+
+#define RTE_EAL_TRACE_GENERIC_FUNC rte_eal_trace_generic_func(__func__)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_EAL_TRACE_H_ */
index f00588d..a77eb17 100644 (file)
@@ -68,6 +68,7 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_LINUX) += eal_common_fbarray.c
 SRCS-$(CONFIG_RTE_EXEC_ENV_LINUX) += eal_common_uuid.c
 SRCS-$(CONFIG_RTE_EXEC_ENV_LINUX) += eal_common_trace.c
 SRCS-$(CONFIG_RTE_EXEC_ENV_LINUX) += eal_common_trace_ctf.c
+SRCS-$(CONFIG_RTE_EXEC_ENV_LINUX) += eal_common_trace_points.c
 SRCS-$(CONFIG_RTE_EXEC_ENV_LINUX) += eal_common_trace_utils.c
 SRCS-$(CONFIG_RTE_EXEC_ENV_LINUX) += rte_malloc.c
 SRCS-$(CONFIG_RTE_EXEC_ENV_LINUX) += hotplug_mp.c
index 8b51c8a..810062f 100644 (file)
@@ -337,6 +337,22 @@ EXPERIMENTAL {
        rte_thread_is_intr;
 
        # added in 20.05
+       __rte_eal_trace_generic_double;
+       __rte_eal_trace_generic_float;
+       __rte_eal_trace_generic_func;
+       __rte_eal_trace_generic_i16;
+       __rte_eal_trace_generic_i32;
+       __rte_eal_trace_generic_i64;
+       __rte_eal_trace_generic_i8;
+       __rte_eal_trace_generic_int;
+       __rte_eal_trace_generic_long;
+       __rte_eal_trace_generic_ptr;
+       __rte_eal_trace_generic_str;
+       __rte_eal_trace_generic_u16;
+       __rte_eal_trace_generic_u32;
+       __rte_eal_trace_generic_u64;
+       __rte_eal_trace_generic_u8;
+       __rte_eal_trace_generic_void;
        __rte_trace_mem_per_thread_alloc;
        __rte_trace_point_emit_field;
        __rte_trace_point_register;