ltt-relay-objs := ltt-events.o ltt-debugfs-abi.o \
ltt-probes.o ltt-core.o ltt-context.o \
lttng-context-pid.o lttng-context-comm.o \
- lttng-context-prio.o lttng-context-nice.o
+ lttng-context-prio.o lttng-context-nice.o \
+ lttng-context-vpid.o lttng-context-tid.o \
+ lttng-context-vtid.o lttng-context-ppid.o \
+ lttng-context-vppid.o
ifneq ($(CONFIG_PERF_EVENTS),)
ltt-relay-objs += lttng-context-perf-counters.o
return lttng_add_prio_to_ctx(ctx);
case LTTNG_KERNEL_CONTEXT_NICE:
return lttng_add_nice_to_ctx(ctx);
+ case LTTNG_KERNEL_CONTEXT_VPID:
+ return lttng_add_vpid_to_ctx(ctx);
+ case LTTNG_KERNEL_CONTEXT_TID:
+ return lttng_add_tid_to_ctx(ctx);
+ case LTTNG_KERNEL_CONTEXT_VTID:
+ return lttng_add_vtid_to_ctx(ctx);
+ case LTTNG_KERNEL_CONTEXT_PPID:
+ return lttng_add_ppid_to_ctx(ctx);
+ case LTTNG_KERNEL_CONTEXT_VPPID:
+ return lttng_add_vppid_to_ctx(ctx);
case LTTNG_KERNEL_CONTEXT_PERF_COUNTER:
context_param.u.perf_counter.name[LTTNG_SYM_NAME_LEN - 1] = '\0';
return lttng_add_perf_counter_to_ctx(context_param.u.perf_counter.type,
LTTNG_KERNEL_CONTEXT_COMM,
LTTNG_KERNEL_CONTEXT_PRIO,
LTTNG_KERNEL_CONTEXT_NICE,
+ LTTNG_KERNEL_CONTEXT_VPID,
+ LTTNG_KERNEL_CONTEXT_TID,
+ LTTNG_KERNEL_CONTEXT_VTID,
+ LTTNG_KERNEL_CONTEXT_PPID,
+ LTTNG_KERNEL_CONTEXT_VPPID,
};
struct lttng_kernel_perf_counter_ctx {
int lttng_add_comm_to_ctx(struct lttng_ctx **ctx);
int lttng_add_prio_to_ctx(struct lttng_ctx **ctx);
int lttng_add_nice_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_vpid_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_tid_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_vtid_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_ppid_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_vppid_to_ctx(struct lttng_ctx **ctx);
int lttng_add_perf_counter_to_ctx(uint32_t type,
uint64_t config,
const char *name,
{
pid_t pid;
- pid = current->pid;
+ pid = task_tgid_nr(current);
lib_ring_buffer_align_ctx(ctx, ltt_alignof(pid));
chan->ops->event_write(ctx, &pid, sizeof(pid));
}
--- /dev/null
+/*
+ * (C) Copyright 2009-2011 -
+ * Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ *
+ * LTTng PPID context.
+ *
+ * Dual LGPL v2.1/GPL v2 license.
+ */
+
+#include <linux/module.h>
+#include <linux/slab.h>
+#include <linux/sched.h>
+#include <linux/syscalls.h>
+#include "ltt-events.h"
+#include "wrapper/ringbuffer/frontend_types.h"
+#include "wrapper/vmalloc.h"
+#include "ltt-tracer.h"
+
+static
+size_t ppid_get_size(size_t offset)
+{
+ size_t size = 0;
+
+ size += lib_ring_buffer_align(offset, ltt_alignof(pid_t));
+ size += sizeof(pid_t);
+ return size;
+}
+
+static
+void ppid_record(struct lttng_ctx_field *field,
+ struct lib_ring_buffer_ctx *ctx,
+ struct ltt_channel *chan)
+{
+ pid_t ppid;
+
+ rcu_read_lock();
+ ppid = task_tgid_nr(current->real_parent);
+ rcu_read_unlock();
+ lib_ring_buffer_align_ctx(ctx, ltt_alignof(ppid));
+ chan->ops->event_write(ctx, &ppid, sizeof(ppid));
+}
+
+int lttng_add_ppid_to_ctx(struct lttng_ctx **ctx)
+{
+ struct lttng_ctx_field *field;
+ int ret;
+
+ field = lttng_append_context(ctx);
+ if (!field)
+ return ret;
+ field->event_field.name = "ppid";
+ field->event_field.type.atype = atype_integer;
+ field->event_field.type.u.basic.integer.size = sizeof(pid_t) * CHAR_BIT;
+ field->event_field.type.u.basic.integer.alignment = ltt_alignof(pid_t) * CHAR_BIT;
+ field->event_field.type.u.basic.integer.signedness = is_signed_type(pid_t);
+ field->event_field.type.u.basic.integer.reverse_byte_order = 0;
+ field->event_field.type.u.basic.integer.base = 10;
+ field->event_field.type.u.basic.integer.encoding = lttng_encode_none;
+ field->get_size = ppid_get_size;
+ field->record = ppid_record;
+ wrapper_vmalloc_sync_all();
+ return 0;
+}
+EXPORT_SYMBOL_GPL(lttng_add_ppid_to_ctx);
+
+MODULE_LICENSE("GPL and additional rights");
+MODULE_AUTHOR("Mathieu Desnoyers");
+MODULE_DESCRIPTION("Linux Trace Toolkit PPID Context");
--- /dev/null
+/*
+ * (C) Copyright 2009-2011 -
+ * Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ *
+ * LTTng TID context.
+ *
+ * Dual LGPL v2.1/GPL v2 license.
+ */
+
+#include <linux/module.h>
+#include <linux/slab.h>
+#include <linux/sched.h>
+#include "ltt-events.h"
+#include "wrapper/ringbuffer/frontend_types.h"
+#include "wrapper/vmalloc.h"
+#include "ltt-tracer.h"
+
+static
+size_t tid_get_size(size_t offset)
+{
+ size_t size = 0;
+
+ size += lib_ring_buffer_align(offset, ltt_alignof(pid_t));
+ size += sizeof(pid_t);
+ return size;
+}
+
+static
+void tid_record(struct lttng_ctx_field *field,
+ struct lib_ring_buffer_ctx *ctx,
+ struct ltt_channel *chan)
+{
+ pid_t tid;
+
+ tid = task_pid_nr(current);
+ lib_ring_buffer_align_ctx(ctx, ltt_alignof(tid));
+ chan->ops->event_write(ctx, &tid, sizeof(tid));
+}
+
+int lttng_add_tid_to_ctx(struct lttng_ctx **ctx)
+{
+ struct lttng_ctx_field *field;
+ int ret;
+
+ field = lttng_append_context(ctx);
+ if (!field)
+ return ret;
+ field->event_field.name = "tid";
+ field->event_field.type.atype = atype_integer;
+ field->event_field.type.u.basic.integer.size = sizeof(pid_t) * CHAR_BIT;
+ field->event_field.type.u.basic.integer.alignment = ltt_alignof(pid_t) * CHAR_BIT;
+ field->event_field.type.u.basic.integer.signedness = is_signed_type(pid_t);
+ field->event_field.type.u.basic.integer.reverse_byte_order = 0;
+ field->event_field.type.u.basic.integer.base = 10;
+ field->event_field.type.u.basic.integer.encoding = lttng_encode_none;
+ field->get_size = tid_get_size;
+ field->record = tid_record;
+ wrapper_vmalloc_sync_all();
+ return 0;
+}
+EXPORT_SYMBOL_GPL(lttng_add_tid_to_ctx);
+
+MODULE_LICENSE("GPL and additional rights");
+MODULE_AUTHOR("Mathieu Desnoyers");
+MODULE_DESCRIPTION("Linux Trace Toolkit TID Context");
--- /dev/null
+/*
+ * (C) Copyright 2009-2011 -
+ * Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ *
+ * LTTng vPID context.
+ *
+ * Dual LGPL v2.1/GPL v2 license.
+ */
+
+#include <linux/module.h>
+#include <linux/slab.h>
+#include <linux/sched.h>
+#include "ltt-events.h"
+#include "wrapper/ringbuffer/frontend_types.h"
+#include "wrapper/vmalloc.h"
+#include "ltt-tracer.h"
+
+static
+size_t vpid_get_size(size_t offset)
+{
+ size_t size = 0;
+
+ size += lib_ring_buffer_align(offset, ltt_alignof(pid_t));
+ size += sizeof(pid_t);
+ return size;
+}
+
+static
+void vpid_record(struct lttng_ctx_field *field,
+ struct lib_ring_buffer_ctx *ctx,
+ struct ltt_channel *chan)
+{
+ pid_t vpid;
+
+ vpid = task_tgid_vnr(current);
+ lib_ring_buffer_align_ctx(ctx, ltt_alignof(vpid));
+ chan->ops->event_write(ctx, &vpid, sizeof(vpid));
+}
+
+int lttng_add_vpid_to_ctx(struct lttng_ctx **ctx)
+{
+ struct lttng_ctx_field *field;
+ int ret;
+
+ field = lttng_append_context(ctx);
+ if (!field)
+ return ret;
+ field->event_field.name = "vpid";
+ field->event_field.type.atype = atype_integer;
+ field->event_field.type.u.basic.integer.size = sizeof(pid_t) * CHAR_BIT;
+ field->event_field.type.u.basic.integer.alignment = ltt_alignof(pid_t) * CHAR_BIT;
+ field->event_field.type.u.basic.integer.signedness = is_signed_type(pid_t);
+ field->event_field.type.u.basic.integer.reverse_byte_order = 0;
+ field->event_field.type.u.basic.integer.base = 10;
+ field->event_field.type.u.basic.integer.encoding = lttng_encode_none;
+ field->get_size = vpid_get_size;
+ field->record = vpid_record;
+ wrapper_vmalloc_sync_all();
+ return 0;
+}
+EXPORT_SYMBOL_GPL(lttng_add_vpid_to_ctx);
+
+MODULE_LICENSE("GPL and additional rights");
+MODULE_AUTHOR("Mathieu Desnoyers");
+MODULE_DESCRIPTION("Linux Trace Toolkit vPID Context");
--- /dev/null
+/*
+ * (C) Copyright 2009-2011 -
+ * Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ *
+ * LTTng vPPID context.
+ *
+ * Dual LGPL v2.1/GPL v2 license.
+ */
+
+#include <linux/module.h>
+#include <linux/slab.h>
+#include <linux/sched.h>
+#include <linux/syscalls.h>
+#include "ltt-events.h"
+#include "wrapper/ringbuffer/frontend_types.h"
+#include "wrapper/vmalloc.h"
+#include "ltt-tracer.h"
+
+static
+size_t vppid_get_size(size_t offset)
+{
+ size_t size = 0;
+
+ size += lib_ring_buffer_align(offset, ltt_alignof(pid_t));
+ size += sizeof(pid_t);
+ return size;
+}
+
+static
+void vppid_record(struct lttng_ctx_field *field,
+ struct lib_ring_buffer_ctx *ctx,
+ struct ltt_channel *chan)
+{
+ pid_t vppid;
+
+ rcu_read_lock();
+ vppid = task_tgid_vnr(current->real_parent);
+ rcu_read_unlock();
+ lib_ring_buffer_align_ctx(ctx, ltt_alignof(vppid));
+ chan->ops->event_write(ctx, &vppid, sizeof(vppid));
+}
+
+int lttng_add_vppid_to_ctx(struct lttng_ctx **ctx)
+{
+ struct lttng_ctx_field *field;
+ int ret;
+
+ field = lttng_append_context(ctx);
+ if (!field)
+ return ret;
+ field->event_field.name = "vppid";
+ field->event_field.type.atype = atype_integer;
+ field->event_field.type.u.basic.integer.size = sizeof(pid_t) * CHAR_BIT;
+ field->event_field.type.u.basic.integer.alignment = ltt_alignof(pid_t) * CHAR_BIT;
+ field->event_field.type.u.basic.integer.signedness = is_signed_type(pid_t);
+ field->event_field.type.u.basic.integer.reverse_byte_order = 0;
+ field->event_field.type.u.basic.integer.base = 10;
+ field->event_field.type.u.basic.integer.encoding = lttng_encode_none;
+ field->get_size = vppid_get_size;
+ field->record = vppid_record;
+ wrapper_vmalloc_sync_all();
+ return 0;
+}
+EXPORT_SYMBOL_GPL(lttng_add_vppid_to_ctx);
+
+MODULE_LICENSE("GPL and additional rights");
+MODULE_AUTHOR("Mathieu Desnoyers");
+MODULE_DESCRIPTION("Linux Trace Toolkit vPPID Context");
--- /dev/null
+/*
+ * (C) Copyright 2009-2011 -
+ * Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ *
+ * LTTng vTID context.
+ *
+ * Dual LGPL v2.1/GPL v2 license.
+ */
+
+#include <linux/module.h>
+#include <linux/slab.h>
+#include <linux/sched.h>
+#include "ltt-events.h"
+#include "wrapper/ringbuffer/frontend_types.h"
+#include "wrapper/vmalloc.h"
+#include "ltt-tracer.h"
+
+static
+size_t vtid_get_size(size_t offset)
+{
+ size_t size = 0;
+
+ size += lib_ring_buffer_align(offset, ltt_alignof(pid_t));
+ size += sizeof(pid_t);
+ return size;
+}
+
+static
+void vtid_record(struct lttng_ctx_field *field,
+ struct lib_ring_buffer_ctx *ctx,
+ struct ltt_channel *chan)
+{
+ pid_t vtid;
+
+ vtid = task_pid_vnr(current);
+ lib_ring_buffer_align_ctx(ctx, ltt_alignof(vtid));
+ chan->ops->event_write(ctx, &vtid, sizeof(vtid));
+}
+
+int lttng_add_vtid_to_ctx(struct lttng_ctx **ctx)
+{
+ struct lttng_ctx_field *field;
+ int ret;
+
+ field = lttng_append_context(ctx);
+ if (!field)
+ return ret;
+ field->event_field.name = "vtid";
+ field->event_field.type.atype = atype_integer;
+ field->event_field.type.u.basic.integer.size = sizeof(pid_t) * CHAR_BIT;
+ field->event_field.type.u.basic.integer.alignment = ltt_alignof(pid_t) * CHAR_BIT;
+ field->event_field.type.u.basic.integer.signedness = is_signed_type(pid_t);
+ field->event_field.type.u.basic.integer.reverse_byte_order = 0;
+ field->event_field.type.u.basic.integer.base = 10;
+ field->event_field.type.u.basic.integer.encoding = lttng_encode_none;
+ field->get_size = vtid_get_size;
+ field->record = vtid_record;
+ wrapper_vmalloc_sync_all();
+ return 0;
+}
+EXPORT_SYMBOL_GPL(lttng_add_vtid_to_ctx);
+
+MODULE_LICENSE("GPL and additional rights");
+MODULE_AUTHOR("Mathieu Desnoyers");
+MODULE_DESCRIPTION("Linux Trace Toolkit vTID Context");