[v2,14/32] eal/trace: hook internal trace APIs to Linux
diff mbox series

Message ID 20200325211603.240288-15-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>

Connect the internal trace interface API to Linux EAL.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
---
 lib/librte_eal/common/eal_common_thread.c | 3 ++-
 lib/librte_eal/linux/eal/eal.c            | 9 +++++++++
 lib/librte_eal/linux/eal/eal_thread.c     | 3 +++
 3 files changed, 14 insertions(+), 1 deletion(-)

Patch
diff mbox series

diff --git a/lib/librte_eal/common/eal_common_thread.c b/lib/librte_eal/common/eal_common_thread.c
index 99fe1aa4e..bc9732d88 100644
--- a/lib/librte_eal/common/eal_common_thread.c
+++ b/lib/librte_eal/common/eal_common_thread.c
@@ -15,6 +15,7 @@ 
 #include <rte_lcore.h>
 #include <rte_memory.h>
 #include <rte_log.h>
+#include <rte_trace.h>
 
 #include "eal_internal_cfg.h"
 #include "eal_private.h"
@@ -165,7 +166,7 @@  static void *rte_thread_init(void *arg)
 		pthread_barrier_destroy(&params->configured);
 		free(params);
 	}
-
+	__rte_trace_mem_per_thread_alloc();
 	return start_routine(routine_arg);
 }
 
diff --git a/lib/librte_eal/linux/eal/eal.c b/lib/librte_eal/linux/eal/eal.c
index 9530ee55f..ee777b0cd 100644
--- a/lib/librte_eal/linux/eal/eal.c
+++ b/lib/librte_eal/linux/eal/eal.c
@@ -58,6 +58,7 @@ 
 #include "eal_filesystem.h"
 #include "eal_hugepages.h"
 #include "eal_memcfg.h"
+#include "eal_trace.h"
 #include "eal_options.h"
 #include "eal_vfio.h"
 #include "hotplug_mp.h"
@@ -1012,6 +1013,12 @@  rte_eal_init(int argc, char **argv)
 		return -1;
 	}
 
+	if (eal_trace_init() < 0) {
+		rte_eal_init_alert("Cannot init trace");
+		rte_errno = EFAULT;
+		return -1;
+	}
+
 	if (eal_option_device_parse()) {
 		rte_errno = ENODEV;
 		rte_atomic32_clear(&run_once);
@@ -1327,6 +1334,8 @@  rte_eal_cleanup(void)
 		rte_memseg_walk(mark_freeable, NULL);
 	rte_service_finalize();
 	rte_mp_channel_cleanup();
+	rte_trace_save();
+	eal_trace_fini();
 	eal_cleanup_config(&internal_config);
 	return 0;
 }
diff --git a/lib/librte_eal/linux/eal/eal_thread.c b/lib/librte_eal/linux/eal/eal_thread.c
index 3f82b286c..45f4dce44 100644
--- a/lib/librte_eal/linux/eal/eal_thread.c
+++ b/lib/librte_eal/linux/eal/eal_thread.c
@@ -20,6 +20,7 @@ 
 #include <rte_per_lcore.h>
 #include <rte_eal.h>
 #include <rte_lcore.h>
+#include <rte_trace.h>
 
 #include "eal_private.h"
 #include "eal_thread.h"
@@ -124,6 +125,8 @@  eal_thread_loop(__attribute__((unused)) void *arg)
 	RTE_LOG(DEBUG, EAL, "lcore %u is ready (tid=%zx;cpuset=[%s%s])\n",
 		lcore_id, (uintptr_t)thread_id, cpuset, ret == 0 ? "" : "...");
 
+	__rte_trace_mem_per_thread_alloc();
+
 	/* read on our pipe to get commands */
 	while (1) {
 		void *fct_arg;