All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH lttng-tools] Add kernel and userspace callstack event context
@ 2017-03-31 13:17 Mathieu Desnoyers
  0 siblings, 0 replies; only message in thread
From: Mathieu Desnoyers @ 2017-03-31 13:17 UTC (permalink / raw)
  To: lttng-dev

From: Francis Giraldeau <francis.giraldeau@gmail.com>

LTTng callstack context. The callstack context can be added to any kernel
channel. It records either the kernel or the userspace callstack, up to a
max depth. The context is a CTF sequence, such that it uses only the space
required for the number of callstack entries.

The symbol name resolution is left to the trace reader.

Signed-off-by: Francis Giraldeau <francis.giraldeau@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
---
 include/lttng/event.h                | 2 ++
 src/bin/lttng-sessiond/context.c     | 6 ++++++
 src/bin/lttng/commands/add_context.c | 4 ++++
 src/common/lttng-kernel.h            | 2 ++
 4 files changed, 14 insertions(+)

diff --git a/include/lttng/event.h b/include/lttng/event.h
index 16b4d4f..cd62cfb 100644
--- a/include/lttng/event.h
+++ b/include/lttng/event.h
@@ -142,6 +142,8 @@ enum lttng_event_context_type {
 	LTTNG_EVENT_CONTEXT_PREEMPTIBLE		= 17,
 	LTTNG_EVENT_CONTEXT_NEED_RESCHEDULE	= 18,
 	LTTNG_EVENT_CONTEXT_MIGRATABLE		= 19,
+	LTTNG_EVENT_CONTEXT_CALLSTACK_KERNEL	= 20,
+	LTTNG_EVENT_CONTEXT_CALLSTACK_USER	= 21,
 };
 
 enum lttng_event_field_type {
diff --git a/src/bin/lttng-sessiond/context.c b/src/bin/lttng-sessiond/context.c
index 9c3a394..b4d82ff 100644
--- a/src/bin/lttng-sessiond/context.c
+++ b/src/bin/lttng-sessiond/context.c
@@ -241,6 +241,12 @@ int context_kernel_add(struct ltt_kernel_session *ksession,
 	case LTTNG_EVENT_CONTEXT_MIGRATABLE:
 		kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_MIGRATABLE;
 		break;
+	case LTTNG_EVENT_CONTEXT_CALLSTACK_KERNEL:
+		kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_CALLSTACK_KERNEL;
+		break;
+	case LTTNG_EVENT_CONTEXT_CALLSTACK_USER:
+		kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_CALLSTACK_USER;
+		break;
 	default:
 		ret = LTTNG_ERR_KERN_CONTEXT_FAIL;
 		goto error;
diff --git a/src/bin/lttng/commands/add_context.c b/src/bin/lttng/commands/add_context.c
index df722bb..c2f3bf1 100644
--- a/src/bin/lttng/commands/add_context.c
+++ b/src/bin/lttng/commands/add_context.c
@@ -78,6 +78,8 @@ enum context_type {
 	CONTEXT_PREEMPTIBLE  = 17,
 	CONTEXT_NEED_RESCHEDULE = 18,
 	CONTEXT_MIGRATABLE   = 19,
+	CONTEXT_CALLSTACK_KERNEL = 20,
+	CONTEXT_CALLSTACK_USER = 21,
 };
 
 /*
@@ -234,6 +236,8 @@ const struct ctx_opts {
 	{ "preemptible", CONTEXT_PREEMPTIBLE },
 	{ "need_reschedule", CONTEXT_NEED_RESCHEDULE },
 	{ "migratable", CONTEXT_MIGRATABLE },
+	{ "callstack-kernel", CONTEXT_CALLSTACK_KERNEL },
+	{ "callstack-user", CONTEXT_CALLSTACK_USER },
 
 	/* Perf options */
 
diff --git a/src/common/lttng-kernel.h b/src/common/lttng-kernel.h
index 8d87539..9d6d60c 100644
--- a/src/common/lttng-kernel.h
+++ b/src/common/lttng-kernel.h
@@ -58,6 +58,8 @@ enum lttng_kernel_context_type {
 	LTTNG_KERNEL_CONTEXT_PREEMPTIBLE    = 13,
 	LTTNG_KERNEL_CONTEXT_NEED_RESCHEDULE = 14,
 	LTTNG_KERNEL_CONTEXT_MIGRATABLE     = 15,
+	LTTNG_KERNEL_CONTEXT_CALLSTACK_KERNEL = 16,
+	LTTNG_KERNEL_CONTEXT_CALLSTACK_USER   = 17,
 };
 
 /* Perf counter attributes */
-- 
2.1.4

_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2017-03-31 13:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-31 13:17 [RFC PATCH lttng-tools] Add kernel and userspace callstack event context Mathieu Desnoyers

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.