[lttng-dev] [PATCH lttng-ust 1/2] Add ust_baddr_statedump start and end events

Antoine Busque abusque at efficios.com
Tue May 19 18:17:35 EDT 2015


These events mark the beginning and end of base addresses state dump,
which happens once per traced application. Note that there is no
guarantee concerning the relative order of multiple start/end events
in the case of overlapping statedumps.  That is to say. if there are
two start events, and two end events, the first end event does not
necessarily correspond to the first start event, and similarly with
the second events.

Signed-off-by: Antoine Busque <abusque at efficios.com>
---
 liblttng-ust/lttng-ust-baddr.c     | 50 ++++++++++++++++++++++++++++++++++++++
 liblttng-ust/ust_baddr_statedump.h | 10 ++++++++
 2 files changed, 60 insertions(+)

diff --git a/liblttng-ust/lttng-ust-baddr.c b/liblttng-ust/lttng-ust-baddr.c
index 922899b..5ec3d40 100644
--- a/liblttng-ust/lttng-ust-baddr.c
+++ b/liblttng-ust/lttng-ust-baddr.c
@@ -89,6 +89,54 @@ int trace_baddr(void *base_addr_ptr,
 }
 
 static
+int trace_statedump_start(void *owner)
+{
+	struct cds_list_head *sessionsp;
+	struct lttng_session *session;
+
+	if (ust_lock()) {
+		ust_unlock();
+		return 1;
+	}
+
+	sessionsp = _lttng_get_sessions();
+	cds_list_for_each_entry(session, sessionsp, node) {
+		if (session->owner != owner)
+			continue;
+		if (!session->statedump_pending)
+			continue;
+		tracepoint(ust_baddr_statedump, start,
+				session);
+	}
+	ust_unlock();
+	return 0;
+}
+
+static
+int trace_statedump_end(void *owner)
+{
+	struct cds_list_head *sessionsp;
+	struct lttng_session *session;
+
+	if (ust_lock()) {
+		ust_unlock();
+		return 1;
+	}
+
+	sessionsp = _lttng_get_sessions();
+	cds_list_for_each_entry(session, sessionsp, node) {
+		if (session->owner != owner)
+			continue;
+		if (!session->statedump_pending)
+			continue;
+		tracepoint(ust_baddr_statedump, end,
+				session);
+	}
+	ust_unlock();
+	return 0;
+}
+
+static
 int extract_soinfo_events(struct dl_phdr_info *info, size_t size, void *_data)
 {
 	int j;
@@ -179,6 +227,7 @@ int lttng_ust_baddr_statedump(void *owner)
 	if (getenv("LTTNG_UST_WITHOUT_BADDR_STATEDUMP"))
 		return 0;
 
+	trace_statedump_start(owner);
 	data.owner = owner;
 	data.exec_baddr = NULL;
 	/*
@@ -194,6 +243,7 @@ int lttng_ust_baddr_statedump(void *owner)
 	 * iteration.
 	 */
 	dump_exec_baddr(&data);
+	trace_statedump_end(owner);
 	return 0;
 }
 
diff --git a/liblttng-ust/ust_baddr_statedump.h b/liblttng-ust/ust_baddr_statedump.h
index 77a9af4..99fb849 100644
--- a/liblttng-ust/ust_baddr_statedump.h
+++ b/liblttng-ust/ust_baddr_statedump.h
@@ -37,6 +37,11 @@ extern "C" {
 #define LTTNG_UST_BADDR_STATEDUMP_PROVIDER
 #include <lttng/tracepoint.h>
 
+TRACEPOINT_EVENT(ust_baddr_statedump, start,
+	TP_ARGS(struct lttng_session *, session),
+	TP_FIELDS()
+)
+
 TRACEPOINT_EVENT(ust_baddr_statedump, soinfo,
 	TP_ARGS(struct lttng_session *, session, void *, baddr, const char*, sopath, int64_t, size, int64_t, mtime),
 	TP_FIELDS(
@@ -47,6 +52,11 @@ TRACEPOINT_EVENT(ust_baddr_statedump, soinfo,
 	)
 )
 
+TRACEPOINT_EVENT(ust_baddr_statedump, end,
+	TP_ARGS(struct lttng_session *, session),
+	TP_FIELDS()
+)
+
 #endif /* _TRACEPOINT_UST_BADDR_STATEDUMP_H */
 
 #undef TRACEPOINT_INCLUDE
-- 
2.4.1




More information about the lttng-dev mailing list