From: Julien Desfossez Date: Thu, 23 Aug 2012 17:24:46 +0000 (-0400) Subject: Fix: missing hostname context X-Git-Tag: v2.1.0-rc3~16 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=54773d681e44cb32d6923bd2db0dcecd4bd10079;p=lttng-tools.git Fix: missing hostname context This context adds the hostname context field for the event(s) selected. It is particularly useful when tracing a machine with containers (lxc), that way we can easily distinguish events generated inside a container. The API is extended but no features nor behaviors are changed. Signed-off-by: Julien Desfossez Signed-off-by: David Goulet --- diff --git a/include/lttng/lttng.h b/include/lttng/lttng.h index 5d3362040..cb3562ffd 100644 --- a/include/lttng/lttng.h +++ b/include/lttng/lttng.h @@ -118,6 +118,7 @@ enum lttng_event_context_type { LTTNG_EVENT_CONTEXT_PPID = 8, LTTNG_EVENT_CONTEXT_VPPID = 9, LTTNG_EVENT_CONTEXT_PTHREAD_ID = 10, + LTTNG_EVENT_CONTEXT_HOSTNAME = 11, }; enum lttng_calibrate_type { diff --git a/src/bin/lttng-sessiond/context.c b/src/bin/lttng-sessiond/context.c index af1c32dea..83085cfc8 100644 --- a/src/bin/lttng-sessiond/context.c +++ b/src/bin/lttng-sessiond/context.c @@ -295,6 +295,9 @@ int context_kernel_add(struct ltt_kernel_session *ksession, case LTTNG_EVENT_CONTEXT_VPPID: kctx.ctx = LTTNG_KERNEL_CONTEXT_VPPID; break; + case LTTNG_EVENT_CONTEXT_HOSTNAME: + kctx.ctx = LTTNG_KERNEL_CONTEXT_HOSTNAME; + break; default: return LTTCOMM_KERN_CONTEXT_FAIL; } diff --git a/src/bin/lttng/commands/add_context.c b/src/bin/lttng/commands/add_context.c index b580d037b..aec2d4df7 100644 --- a/src/bin/lttng/commands/add_context.c +++ b/src/bin/lttng/commands/add_context.c @@ -67,6 +67,7 @@ enum context_type { CONTEXT_PPID = 8, CONTEXT_VPPID = 9, CONTEXT_PTHREAD_ID = 10, + CONTEXT_HOSTNAME = 11, }; /* @@ -203,6 +204,7 @@ const struct ctx_opts { { "vtid", CONTEXT_VTID }, { "ppid", CONTEXT_PPID }, { "vppid", CONTEXT_VPPID }, + { "hostname", CONTEXT_HOSTNAME }, /* Perf options */ PERF_HW(cpu-cycles, CPU_CYCLES), PERF_HW(cycles, CPU_CYCLES), diff --git a/src/common/lttng-kernel.h b/src/common/lttng-kernel.h index cbeed1b19..dbeb6aa0a 100644 --- a/src/common/lttng-kernel.h +++ b/src/common/lttng-kernel.h @@ -51,6 +51,7 @@ enum lttng_kernel_context_type { LTTNG_KERNEL_CONTEXT_VTID = 7, LTTNG_KERNEL_CONTEXT_PPID = 8, LTTNG_KERNEL_CONTEXT_VPPID = 9, + LTTNG_KERNEL_CONTEXT_HOSTNAME = 10, }; /* Perf counter attributes */