[v2,16/32] eal/trace: add generic tracepoints
diff mbox series

Message ID 20200325211603.240288-17-jerinj@marvell.com
State Superseded
Delegated to: Thomas Monjalon
Headers show
Series
  • DPDK Trace support
Related show

Checks

Context Check Description
ci/Intel-compilation fail Compilation issues
ci/checkpatch success coding style OK

Commit Message

Jerin Jacob Kollanukkaran March 25, 2020, 9:15 p.m. UTC
From: Jerin Jacob <jerinj@marvell.com>

This patch creates the following generic tracepoint for
generic tracing when there is no dedicated tracepoint is
available.

rte_trace_lib_eal_generic_void()
rte_trace_lib_eal_generic_u64()
rte_trace_lib_eal_generic_u32()
rte_trace_lib_eal_generic_u16()
rte_trace_lib_eal_generic_u8()
rte_trace_lib_eal_generic_i64()
rte_trace_lib_eal_generic_i32()
rte_trace_lib_eal_generic_i16()
rte_trace_lib_eal_generic_i8()
rte_trace_lib_eal_generic_int()
rte_trace_lib_eal_generic_long()
rte_trace_lib_eal_generic_float()
rte_trace_lib_eal_generic_double()
rte_trace_lib_eal_generic_ptr()
rte_trace_lib_eal_generic_str()

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

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
---
 lib/librte_eal/common/Makefile                |   2 +-
 .../common/eal_common_trace_points.c          |  60 +++++++++
 lib/librte_eal/common/include/rte_trace_eal.h | 122 ++++++++++++++++++
 lib/librte_eal/common/meson.build             |   2 +
 lib/librte_eal/freebsd/eal/Makefile           |   1 +
 lib/librte_eal/linux/eal/Makefile             |   1 +
 lib/librte_eal/rte_eal_version.map            |  17 +++
 7 files changed, 204 insertions(+), 1 deletion(-)
 create mode 100644 lib/librte_eal/common/eal_common_trace_points.c
 create mode 100644 lib/librte_eal/common/include/rte_trace_eal.h

Patch
diff mbox series

diff --git a/lib/librte_eal/common/Makefile b/lib/librte_eal/common/Makefile
index 8f2f25c1d..452e5e93d 100644
--- a/lib/librte_eal/common/Makefile
+++ b/lib/librte_eal/common/Makefile
@@ -9,7 +9,7 @@  INC += rte_debug.h rte_eal.h rte_eal_interrupts.h
 INC += rte_errno.h rte_launch.h rte_lcore.h
 INC += rte_log.h rte_memory.h rte_memzone.h
 INC += rte_per_lcore.h rte_random.h
-INC += rte_trace.h rte_trace_provider.h rte_trace_register.h
+INC += rte_trace.h rte_trace_eal.h rte_trace_provider.h rte_trace_register.h
 INC += rte_tailq.h rte_interrupts.h rte_alarm.h
 INC += rte_string_fns.h rte_version.h
 INC += rte_eal_memconfig.h
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
index 000000000..ff521c981
--- /dev/null
+++ b/lib/librte_eal/common/eal_common_trace_points.c
@@ -0,0 +1,60 @@ 
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2020 Marvell International Ltd.
+ */
+
+#define RTE_TRACE_POINT_REGISTER_SELECT /* Select trace point register macros */
+
+#include <rte_trace_eal.h>
+
+RTE_TRACE_POINT_DEFINE(rte_trace_lib_eal_generic_void);
+RTE_TRACE_POINT_DEFINE(rte_trace_lib_eal_generic_u64);
+RTE_TRACE_POINT_DEFINE(rte_trace_lib_eal_generic_u32);
+RTE_TRACE_POINT_DEFINE(rte_trace_lib_eal_generic_u16);
+RTE_TRACE_POINT_DEFINE(rte_trace_lib_eal_generic_u8);
+RTE_TRACE_POINT_DEFINE(rte_trace_lib_eal_generic_i64);
+RTE_TRACE_POINT_DEFINE(rte_trace_lib_eal_generic_i32);
+RTE_TRACE_POINT_DEFINE(rte_trace_lib_eal_generic_i16);
+RTE_TRACE_POINT_DEFINE(rte_trace_lib_eal_generic_i8);
+RTE_TRACE_POINT_DEFINE(rte_trace_lib_eal_generic_int);
+RTE_TRACE_POINT_DEFINE(rte_trace_lib_eal_generic_long);
+RTE_TRACE_POINT_DEFINE(rte_trace_lib_eal_generic_float);
+RTE_TRACE_POINT_DEFINE(rte_trace_lib_eal_generic_double);
+RTE_TRACE_POINT_DEFINE(rte_trace_lib_eal_generic_ptr);
+RTE_TRACE_POINT_DEFINE(rte_trace_lib_eal_generic_str);
+RTE_TRACE_POINT_DEFINE(rte_trace_lib_eal_generic_func);
+
+RTE_INIT(eal_trace_init)
+{
+	RTE_TRACE_POINT_REGISTER(rte_trace_lib_eal_generic_void,
+				 lib.eal.generic.void, INFO);
+	RTE_TRACE_POINT_REGISTER(rte_trace_lib_eal_generic_u64,
+				 lib.eal.generic.u64, INFO);
+	RTE_TRACE_POINT_REGISTER(rte_trace_lib_eal_generic_u32,
+				 lib.eal.generic.u32, INFO);
+	RTE_TRACE_POINT_REGISTER(rte_trace_lib_eal_generic_u16,
+				 lib.eal.generic.u16, INFO);
+	RTE_TRACE_POINT_REGISTER(rte_trace_lib_eal_generic_u8,
+				 lib.eal.generic.u8, INFO);
+	RTE_TRACE_POINT_REGISTER(rte_trace_lib_eal_generic_i64,
+				 lib.eal.generic.i64, INFO);
+	RTE_TRACE_POINT_REGISTER(rte_trace_lib_eal_generic_i32,
+				 lib.eal.generic.i32, INFO);
+	RTE_TRACE_POINT_REGISTER(rte_trace_lib_eal_generic_i16,
+				 lib.eal.generic.i16, INFO);
+	RTE_TRACE_POINT_REGISTER(rte_trace_lib_eal_generic_i8,
+				 lib.eal.generic.i8, INFO);
+	RTE_TRACE_POINT_REGISTER(rte_trace_lib_eal_generic_int,
+				 lib.eal.generic.int, INFO);
+	RTE_TRACE_POINT_REGISTER(rte_trace_lib_eal_generic_long,
+				 lib.eal.generic.long, INFO);
+	RTE_TRACE_POINT_REGISTER(rte_trace_lib_eal_generic_float,
+				 lib.eal.generic.float, INFO);
+	RTE_TRACE_POINT_REGISTER(rte_trace_lib_eal_generic_double,
+				 lib.eal.generic.double, INFO);
+	RTE_TRACE_POINT_REGISTER(rte_trace_lib_eal_generic_ptr,
+				 lib.eal.generic.ptr, INFO);
+	RTE_TRACE_POINT_REGISTER(rte_trace_lib_eal_generic_str,
+				 lib.eal.generic.string, INFO);
+	RTE_TRACE_POINT_REGISTER(rte_trace_lib_eal_generic_func,
+				 lib.eal.generic.func, INFO);
+}
diff --git a/lib/librte_eal/common/include/rte_trace_eal.h b/lib/librte_eal/common/include/rte_trace_eal.h
new file mode 100644
index 000000000..269ef7502
--- /dev/null
+++ b/lib/librte_eal/common/include/rte_trace_eal.h
@@ -0,0 +1,122 @@ 
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2020 Marvell International Ltd.
+ */
+
+#ifndef _RTE_TRACE_EAL_H_
+#define _RTE_TRACE_EAL_H_
+
+/**
+ * @file
+ *
+ * API for EAL trace support
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_trace.h>
+
+/* Generic */
+RTE_TRACE_POINT(
+	rte_trace_lib_eal_generic_void,
+	RTE_TRACE_POINT_ARGS(void),
+)
+
+RTE_TRACE_POINT(
+	rte_trace_lib_eal_generic_u64,
+	RTE_TRACE_POINT_ARGS(uint64_t in),
+	rte_trace_ctf_u64(in);
+)
+
+RTE_TRACE_POINT(
+	rte_trace_lib_eal_generic_u32,
+	RTE_TRACE_POINT_ARGS(uint32_t in),
+	rte_trace_ctf_u32(in);
+)
+
+RTE_TRACE_POINT(
+	rte_trace_lib_eal_generic_u16,
+	RTE_TRACE_POINT_ARGS(uint16_t in),
+	rte_trace_ctf_u16(in);
+)
+
+RTE_TRACE_POINT(
+	rte_trace_lib_eal_generic_u8,
+	RTE_TRACE_POINT_ARGS(uint8_t in),
+	rte_trace_ctf_u8(in);
+)
+
+RTE_TRACE_POINT(
+	rte_trace_lib_eal_generic_i64,
+	RTE_TRACE_POINT_ARGS(int64_t in),
+	rte_trace_ctf_i64(in);
+)
+
+RTE_TRACE_POINT(
+	rte_trace_lib_eal_generic_i32,
+	RTE_TRACE_POINT_ARGS(int32_t in),
+	rte_trace_ctf_i32(in);
+)
+
+RTE_TRACE_POINT(
+	rte_trace_lib_eal_generic_i16,
+	RTE_TRACE_POINT_ARGS(int16_t in),
+	rte_trace_ctf_i16(in);
+)
+
+RTE_TRACE_POINT(
+	rte_trace_lib_eal_generic_i8,
+	RTE_TRACE_POINT_ARGS(int8_t in),
+	rte_trace_ctf_i8(in);
+)
+
+RTE_TRACE_POINT(
+	rte_trace_lib_eal_generic_int,
+	RTE_TRACE_POINT_ARGS(int in),
+	rte_trace_ctf_int(in);
+)
+
+RTE_TRACE_POINT(
+	rte_trace_lib_eal_generic_long,
+	RTE_TRACE_POINT_ARGS(long in),
+	rte_trace_ctf_long(in);
+)
+
+RTE_TRACE_POINT(
+	rte_trace_lib_eal_generic_float,
+	RTE_TRACE_POINT_ARGS(float in),
+	rte_trace_ctf_float(in);
+)
+
+RTE_TRACE_POINT(
+	rte_trace_lib_eal_generic_double,
+	RTE_TRACE_POINT_ARGS(double in),
+	rte_trace_ctf_double(in);
+)
+
+RTE_TRACE_POINT(
+	rte_trace_lib_eal_generic_ptr,
+	RTE_TRACE_POINT_ARGS(const void *ptr),
+	rte_trace_ctf_ptr(ptr);
+)
+
+RTE_TRACE_POINT(
+	rte_trace_lib_eal_generic_str,
+	RTE_TRACE_POINT_ARGS(const char *str),
+	rte_trace_ctf_string(str);
+)
+
+RTE_TRACE_POINT(
+	rte_trace_lib_eal_generic_func,
+	RTE_TRACE_POINT_ARGS(const char *func),
+	rte_trace_ctf_string(func);
+)
+
+#define RTE_TRACE_LIB_EAL_GENERIC_FUNC rte_trace_lib_eal_generic_func(__func__)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_TRACE_EAL_H_ */
diff --git a/lib/librte_eal/common/meson.build b/lib/librte_eal/common/meson.build
index 4ccdf1eee..7f11377b3 100644
--- a/lib/librte_eal/common/meson.build
+++ b/lib/librte_eal/common/meson.build
@@ -30,6 +30,7 @@  common_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',
@@ -88,6 +89,7 @@  common_headers = files(
 	'include/rte_string_fns.h',
 	'include/rte_tailq.h',
 	'include/rte_trace.h',
+	'include/rte_trace_eal.h',
 	'include/rte_trace_provider.h',
 	'include/rte_trace_register.h',
 	'include/rte_time.h',
diff --git a/lib/librte_eal/freebsd/eal/Makefile b/lib/librte_eal/freebsd/eal/Makefile
index 546d79514..07232ba97 100644
--- a/lib/librte_eal/freebsd/eal/Makefile
+++ b/lib/librte_eal/freebsd/eal/Makefile
@@ -62,6 +62,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
diff --git a/lib/librte_eal/linux/eal/Makefile b/lib/librte_eal/linux/eal/Makefile
index 1980e9fc5..6158eb0b8 100644
--- a/lib/librte_eal/linux/eal/Makefile
+++ b/lib/librte_eal/linux/eal/Makefile
@@ -70,6 +70,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
diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map
index e54e7637c..9d56715b6 100644
--- a/lib/librte_eal/rte_eal_version.map
+++ b/lib/librte_eal/rte_eal_version.map
@@ -364,4 +364,21 @@  EXPERIMENTAL {
 	rte_trace_save;
 	rte_trace_metadata_dump;
 	rte_trace_dump;
+
+	__rte_trace_lib_eal_generic_void;
+	__rte_trace_lib_eal_generic_u64;
+	__rte_trace_lib_eal_generic_u32;
+	__rte_trace_lib_eal_generic_u16;
+	__rte_trace_lib_eal_generic_u8;
+	__rte_trace_lib_eal_generic_i64;
+	__rte_trace_lib_eal_generic_i32;
+	__rte_trace_lib_eal_generic_i16;
+	__rte_trace_lib_eal_generic_i8;
+	__rte_trace_lib_eal_generic_int;
+	__rte_trace_lib_eal_generic_long;
+	__rte_trace_lib_eal_generic_float;
+	__rte_trace_lib_eal_generic_double;
+	__rte_trace_lib_eal_generic_ptr;
+	__rte_trace_lib_eal_generic_str;
+	__rte_trace_lib_eal_generic_func;
 };