ust/tracepoint.h \
ust/tracepoint_event.h \
ust/probe.h \
- ust/version.h
+ ust/version.h \
+ ust/lttng-ust-abi.h \
+ ust/ringbuffer-abi.h
noinst_HEADERS = \
share.h \
* all copies or substantial portions of the Software.
*/
-#include "../ltt-endian.h"
-
-#ifndef CHAR_BIT
-#define CHAR_BIT 8
-#endif
+#include <stdint.h> /* C99 5.2.4.2 Numerical limits */
+#include <limits.h> /* C99 5.2.4.2 Numerical limits */
+#include <endian.h> /* Non-standard BIG_ENDIAN, LITTLE_ENDIAN, BYTE_ORDER */
+#include <assert.h>
/* We can't shift a int from 32 bit, >> 32 and << 32 on int is undefined */
#define _bt_piecewise_rshift(_v, _shift) \
* bt_bitfield_write_be - write integer to a bitfield in big endian
*/
-#if (__BYTE_ORDER == __LITTLE_ENDIAN)
+#if (BYTE_ORDER == LITTLE_ENDIAN)
#define bt_bitfield_write(ptr, type, _start, _length, _v) \
_bt_bitfield_write_le(ptr, type, _start, _length, _v)
#define bt_bitfield_write_be(ptr, type, _start, _length, _v) \
_bt_bitfield_write_be(ptr, unsigned char, _start, _length, _v)
-#elif (__BYTE_ORDER == __BIG_ENDIAN)
+#elif (BYTE_ORDER == BIG_ENDIAN)
#define bt_bitfield_write(ptr, type, _start, _length, _v) \
_bt_bitfield_write_be(ptr, type, _start, _length, _v)
* bt_bitfield_read_be - read integer from a bitfield in big endian
*/
-#if (__BYTE_ORDER == __LITTLE_ENDIAN)
+#if (BYTE_ORDER == LITTLE_ENDIAN)
#define bt_bitfield_read(_ptr, type, _start, _length, _vptr) \
_bt_bitfield_read_le(_ptr, type, _start, _length, _vptr)
#define bt_bitfield_read_be(_ptr, type, _start, _length, _vptr) \
_bt_bitfield_read_be(_ptr, unsigned char, _start, _length, _vptr)
-#elif (__BYTE_ORDER == __BIG_ENDIAN)
+#elif (BYTE_ORDER == BIG_ENDIAN)
#define bt_bitfield_read(_ptr, type, _start, _length, _vptr) \
_bt_bitfield_read_be(_ptr, type, _start, _length, _vptr)
#define bt_bitfield_read_be(_ptr, type, _start, _length, _vptr) \
_bt_bitfield_read_be(_ptr, type, _start, _length, _vptr)
-#else /* (__BYTE_ORDER == __PDP_ENDIAN) */
+#else /* (BYTE_ORDER == PDP_ENDIAN) */
#error "Byte order not supported"
#define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
#endif
+#ifndef UST_VALGRIND
+
+static __inline__ int ust_get_cpu(void)
+{
+ int cpu;
+
+ cpu = sched_getcpu();
+ if (likely(cpu >= 0))
+ return cpu;
+ /*
+ * If getcpu(2) is not implemented in the Kernel use CPU 0 as fallback.
+ */
+ return 0;
+}
+
+#else /* #else #ifndef UST_VALGRIND */
+
+static __inline__ int ust_get_cpu(void)
+{
+ /*
+ * Valgrind does not support the sched_getcpu() vsyscall.
+ * It causes it to detect a segfault in the program and stop it.
+ * So if we want to check libust with valgrind, we have to refrain
+ * from using this call. TODO: it would probably be better to return
+ * other values too, to better test it.
+ */
+ return 0;
+}
+
+#endif /* #else #ifndef UST_VALGRIND */
+
#endif /* UST_CORE_H */
--- /dev/null
+#ifndef _LTTNG_UST_ABI_H
+#define _LTTNG_UST_ABI_H
+
+/*
+ * lttng-ust-abi.h
+ *
+ * Copyright 2010-2011 (c) - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ *
+ * LTTng-UST ABI header
+ *
+ * Dual LGPL v2.1/GPL v2 license.
+ */
+
+#define LTTNG_UST_SYM_NAME_LEN 128
+
+enum lttng_ust_instrumentation {
+ LTTNG_UST_TRACEPOINT = 0,
+};
+
+/*
+ * LTTng consumer mode
+ */
+enum lttng_ust_output {
+ LTTNG_UST_MMAP = 0,
+};
+
+/*
+ * LTTng DebugFS ABI structures.
+ */
+
+struct lttng_ust_channel {
+ int overwrite; /* 1: overwrite, 0: discard */
+ uint64_t subbuf_size; /* in bytes */
+ uint64_t num_subbuf;
+ unsigned int switch_timer_interval; /* usecs */
+ unsigned int read_timer_interval; /* usecs */
+ enum lttng_ust_output output; /* mmap */
+};
+
+struct lttng_ust_event {
+ char name[LTTNG_UST_SYM_NAME_LEN]; /* event name */
+ enum lttng_ust_instrumentation instrumentation;
+ /* Per instrumentation type configuration */
+ union {
+ } u;
+};
+
+struct lttng_ust_tracer_version {
+ uint32_t version;
+ uint32_t patchlevel;
+ uint32_t sublevel;
+};
+
+enum lttng_ust_context_type {
+ LTTNG_UST_CONTEXT_VTID = 0,
+};
+
+struct lttng_ust_context {
+ enum lttng_ust_context_type ctx;
+ union {
+ } u;
+};
+
+#define _UST_CMD(minor) (minor)
+#define _UST_CMDR(minor, type) (minor)
+#define _UST_CMDW(minor, type) (minor)
+
+/* LTTng-UST commands */
+#define LTTNG_UST_SESSION _UST_CMD(0x40)
+#define LTTNG_UST_TRACER_VERSION \
+ _UST_CMDR(0x41, struct lttng_ust_tracer_version)
+#define LTTNG_UST_TRACEPOINT_LIST _UST_CMD(0x42)
+#define LTTNG_UST_WAIT_QUIESCENT _UST_CMD(0x43)
+
+/* Session FD ioctl */
+#define LTTNG_UST_METADATA \
+ _UST_CMDW(0x50, struct lttng_ust_channel)
+#define LTTNG_UST_CHANNEL \
+ _UST_CMDW(0x51, struct lttng_ust_channel)
+#define LTTNG_UST_SESSION_START _UST_CMD(0x52)
+#define LTTNG_UST_SESSION_STOP _UST_CMD(0x53)
+
+/* Channel FD ioctl */
+#define LTTNG_UST_STREAM _UST_CMD(0x60)
+#define LTTNG_UST_EVENT \
+ _UST_CMDW(0x61, struct lttng_ust_event)
+
+/* Event and Channel FD ioctl */
+#define LTTNG_UST_CONTEXT \
+ _UST_CMDW(0x70, struct lttng_ust_context)
+
+/* Event, Channel and Session ioctl */
+#define LTTNG_UST_ENABLE _UST_CMD(0x80)
+#define LTTNG_UST_DISABLE _UST_CMD(0x81)
+
+#endif /* _LTTNG_UST_ABI_H */
--- /dev/null
+#ifndef _UST_RING_BUFFER_ABI_H
+#define _UST_RING_BUFFER_ABI_H
+
+/*
+ * ust/ringbuffer-abi.h
+ *
+ * (C) Copyright 2005-2010 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ *
+ * Wait-free ring buffer ABI.
+ *
+ * Author:
+ * Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ *
+ * Dual LGPL v2.1/GPL v2 license.
+ */
+
+#define _UST_CMD(minor) (minor)
+#define _UST_CMDR(minor, type) (minor)
+#define _UST_CMDW(minor, type) (minor)
+
+/*
+ * Use RING_BUFFER_GET_NEXT_SUBBUF / RING_BUFFER_PUT_NEXT_SUBBUF to read and
+ * consume sub-buffers sequentially.
+ *
+ * Reading sub-buffers without consuming them can be performed with:
+ *
+ * RING_BUFFER_SNAPSHOT
+ * RING_BUFFER_SNAPSHOT_GET_CONSUMED
+ * RING_BUFFER_SNAPSHOT_GET_PRODUCED
+ *
+ * to get the offset range to consume, and then by passing each sub-buffer
+ * offset to RING_BUFFER_GET_SUBBUF, read the sub-buffer, and then release it
+ * with RING_BUFFER_PUT_SUBBUF.
+ *
+ * Note that the "snapshot" API can be used to read the sub-buffer in reverse
+ * order, which is useful for flight recorder snapshots.
+ */
+
+/* Get a snapshot of the current ring buffer producer and consumer positions */
+#define RING_BUFFER_SNAPSHOT _UST_CMD(0x00)
+/* Get the consumer position (iteration start) */
+#define RING_BUFFER_SNAPSHOT_GET_CONSUMED _UST_CMDR(0x01, unsigned long)
+/* Get the producer position (iteration end) */
+#define RING_BUFFER_SNAPSHOT_GET_PRODUCED _UST_CMDR(0x02, unsigned long)
+/* Get exclusive read access to the specified sub-buffer position */
+#define RING_BUFFER_GET_SUBBUF _UST_CMDW(0x03, unsigned long)
+/* Release exclusive sub-buffer access */
+#define RING_BUFFER_PUT_SUBBUF _UST_CMD(0x04)
+
+/* Get exclusive read access to the next sub-buffer that can be read. */
+#define RING_BUFFER_GET_NEXT_SUBBUF _UST_CMD(0x05)
+/* Release exclusive sub-buffer access, move consumer forward. */
+#define RING_BUFFER_PUT_NEXT_SUBBUF _UST_CMD(0x06)
+/* returns the size of the current sub-buffer, without padding (for mmap). */
+#define RING_BUFFER_GET_SUBBUF_SIZE _UST_CMDR(0x07, unsigned long)
+/* returns the size of the current sub-buffer, with padding (for splice). */
+#define RING_BUFFER_GET_PADDED_SUBBUF_SIZE _UST_CMDR(0x08, unsigned long)
+/* returns the maximum size for sub-buffers. */
+#define RING_BUFFER_GET_MAX_SUBBUF_SIZE _UST_CMDR(0x09, unsigned long)
+/* returns the length to mmap. */
+#define RING_BUFFER_GET_MMAP_LEN _UST_CMDR(0x0A, unsigned long)
+/* returns the offset of the subbuffer belonging to the mmap reader. */
+#define RING_BUFFER_GET_MMAP_READ_OFFSET _UST_CMDR(0x0B, unsigned long)
+/* flush the current sub-buffer */
+#define RING_BUFFER_FLUSH _UST_CMD(0x0C)
+
+#endif /* _UST_RING_BUFFER_ABI_H */
#include "backend.h"
#include "frontend.h"
-#include "vfs.h"
+#include <ust/ringbuffer-abi.h>
/*
* ring_buffer_frontend_api.h contains static inline functions that depend on
*/
#include "frontend.h"
+#include "ust/core.h"
+#include <urcu-bp.h>
+#include <urcu/compiler.h>
/**
* lib_ring_buffer_get_cpu - Precedes ring buffer reserve/commit.
*
- * Disables preemption (acts as a RCU read-side critical section) and keeps a
- * ring buffer nesting count as supplementary safety net to ensure tracer client
- * code will never trigger an endless recursion. Returns the processor ID on
- * success, -EPERM on failure (nesting count too high).
+ * Grabs RCU read-side lock and keeps a ring buffer nesting count as
+ * supplementary safety net to ensure tracer client code will never
+ * trigger an endless recursion. Returns the processor ID on success,
+ * -EPERM on failure (nesting count too high).
*
* asm volatile and "memory" clobber prevent the compiler from moving
* instructions out of the ring buffer nesting count. This is required to ensure
{
int cpu, nesting;
- rcu_read_lock_sched_notrace();
- cpu = smp_processor_id();
+ rcu_read_lock();
+ cpu = ust_get_cpu();
nesting = ++lib_ring_buffer_nesting; /* TLS */
- barrier();
+ cmm_barrier();
if (unlikely(nesting > 4)) {
WARN_ON_ONCE(1);
lib_ring_buffer_nesting--; /* TLS */
- rcu_read_unlock_sched_notrace();
+ rcu_read_unlock();
return -EPERM;
} else
return cpu;
static inline
void lib_ring_buffer_put_cpu(const struct lib_ring_buffer_config *config)
{
- barrier();
+ cmm_barrier();
lib_ring_buffer_nesting--; /* TLS */
- rcu_read_unlock_sched_notrace();
+ rcu_read_unlock();
}
/*
* commit counter to increment it and commit seq value to compare it to
* the commit counter.
*/
- prefetch(&buf->commit_hot[subbuf_index(*o_begin, chan)]);
+ //prefetch(&buf->commit_hot[subbuf_index(*o_begin, chan)]);
if (last_tsc_overflow(config, buf, ctx->tsc))
ctx->rflags |= RING_BUFFER_RFLAG_FULL_TSC;
unsigned long o_begin, o_end, o_old;
size_t before_hdr_pad = 0;
- if (atomic_read(&chan->record_disabled))
+ if (uatomic_read(&chan->record_disabled))
return -EAGAIN;
if (config->alloc == RING_BUFFER_ALLOC_PER_CPU)
- buf = per_cpu_ptr(chan->backend.buf, ctx->cpu);
+ buf = &shmp(chan->backend.buf)[ctx->cpu];
else
- buf = chan->backend.buf;
- if (atomic_read(&buf->record_disabled))
+ buf = shmp(chan->backend.buf);
+ if (uatomic_read(&buf->record_disabled))
return -EAGAIN;
ctx->buf = buf;
* Order all writes to buffer before the commit count update that will
* determine that the subbuffer is full.
*/
- if (config->ipi == RING_BUFFER_IPI_BARRIER) {
- /*
- * Must write slot data before incrementing commit count. This
- * compiler barrier is upgraded into a smp_mb() by the IPI sent
- * by get_subbuf().
- */
- barrier();
- } else
- smp_wmb();
+ cmm_smp_wmb();
- v_add(config, ctx->slot_size, &buf->commit_hot[endidx].cc);
+ v_add(config, ctx->slot_size, &shmp(buf->commit_hot)[endidx].cc);
/*
* commit count read can race with concurrent OOO commit count updates.
* count reaches back the reserve offset for a specific sub-buffer,
* which is completely independent of the order.
*/
- commit_count = v_read(config, &buf->commit_hot[endidx].cc);
+ commit_count = v_read(config, &shmp(buf->commit_hot)[endidx].cc);
lib_ring_buffer_check_deliver(config, buf, chan, offset_end - 1,
commit_count, endidx);
void channel_record_disable(const struct lib_ring_buffer_config *config,
struct channel *chan)
{
- atomic_inc(&chan->record_disabled);
+ uatomic_inc(&chan->record_disabled);
}
static inline
void channel_record_enable(const struct lib_ring_buffer_config *config,
struct channel *chan)
{
- atomic_dec(&chan->record_disabled);
+ uatomic_dec(&chan->record_disabled);
}
static inline
void lib_ring_buffer_record_disable(const struct lib_ring_buffer_config *config,
struct lib_ring_buffer *buf)
{
- atomic_inc(&buf->record_disabled);
+ uatomic_inc(&buf->record_disabled);
}
static inline
void lib_ring_buffer_record_enable(const struct lib_ring_buffer_config *config,
struct lib_ring_buffer *buf)
{
- atomic_dec(&buf->record_disabled);
+ uatomic_dec(&buf->record_disabled);
}
#endif /* _LINUX_RING_BUFFER_FRONTEND_API_H */
/*
- * ring_buffer_vfs.c
+ * ring_buffer_abi.c
*
* Copyright (C) 2009-2010 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
*
#include "backend.h"
#include "frontend.h"
-#include "vfs.h"
+#include <ust/ring-buffer-abi.h>
static int put_ulong(unsigned long val, unsigned long arg)
{
+++ /dev/null
-#ifndef _LINUX_RING_BUFFER_VFS_H
-#define _LINUX_RING_BUFFER_VFS_H
-
-/*
- * linux/ringbuffer/vfs.h
- *
- * (C) Copyright 2005-2010 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * Wait-free ring buffer VFS file operations.
- *
- * Author:
- * Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * Dual LGPL v2.1/GPL v2 license.
- */
-
-/* VFS API */
-
-extern const struct file_operations lib_ring_buffer_file_operations;
-
-/*
- * Internal file operations.
- */
-
-int lib_ring_buffer_open(struct inode *inode, struct file *file);
-int lib_ring_buffer_release(struct inode *inode, struct file *file);
-unsigned int lib_ring_buffer_poll(struct file *filp, poll_table *wait);
-ssize_t lib_ring_buffer_splice_read(struct file *in, loff_t *ppos,
- struct pipe_inode_info *pipe, size_t len,
- unsigned int flags);
-int lib_ring_buffer_mmap(struct file *filp, struct vm_area_struct *vma);
-
-/* Ring Buffer ioctl() and ioctl numbers */
-long lib_ring_buffer_ioctl(struct file *filp, unsigned int cmd, unsigned long arg);
-#ifdef CONFIG_COMPAT
-long lib_ring_buffer_compat_ioctl(struct file *filp, unsigned int cmd,
- unsigned long arg);
-#endif
-
-/*
- * Use RING_BUFFER_GET_NEXT_SUBBUF / RING_BUFFER_PUT_NEXT_SUBBUF to read and
- * consume sub-buffers sequentially.
- *
- * Reading sub-buffers without consuming them can be performed with:
- *
- * RING_BUFFER_SNAPSHOT
- * RING_BUFFER_SNAPSHOT_GET_CONSUMED
- * RING_BUFFER_SNAPSHOT_GET_PRODUCED
- *
- * to get the offset range to consume, and then by passing each sub-buffer
- * offset to RING_BUFFER_GET_SUBBUF, read the sub-buffer, and then release it
- * with RING_BUFFER_PUT_SUBBUF.
- *
- * Note that the "snapshot" API can be used to read the sub-buffer in reverse
- * order, which is useful for flight recorder snapshots.
- */
-
-/* Get a snapshot of the current ring buffer producer and consumer positions */
-#define RING_BUFFER_SNAPSHOT _IO(0xF6, 0x00)
-/* Get the consumer position (iteration start) */
-#define RING_BUFFER_SNAPSHOT_GET_CONSUMED _IOR(0xF6, 0x01, unsigned long)
-/* Get the producer position (iteration end) */
-#define RING_BUFFER_SNAPSHOT_GET_PRODUCED _IOR(0xF6, 0x02, unsigned long)
-/* Get exclusive read access to the specified sub-buffer position */
-#define RING_BUFFER_GET_SUBBUF _IOW(0xF6, 0x03, unsigned long)
-/* Release exclusive sub-buffer access */
-#define RING_BUFFER_PUT_SUBBUF _IO(0xF6, 0x04)
-
-/* Get exclusive read access to the next sub-buffer that can be read. */
-#define RING_BUFFER_GET_NEXT_SUBBUF _IO(0xF6, 0x05)
-/* Release exclusive sub-buffer access, move consumer forward. */
-#define RING_BUFFER_PUT_NEXT_SUBBUF _IO(0xF6, 0x06)
-/* returns the size of the current sub-buffer, without padding (for mmap). */
-#define RING_BUFFER_GET_SUBBUF_SIZE _IOR(0xF6, 0x07, unsigned long)
-/* returns the size of the current sub-buffer, with padding (for splice). */
-#define RING_BUFFER_GET_PADDED_SUBBUF_SIZE _IOR(0xF6, 0x08, unsigned long)
-/* returns the maximum size for sub-buffers. */
-#define RING_BUFFER_GET_MAX_SUBBUF_SIZE _IOR(0xF6, 0x09, unsigned long)
-/* returns the length to mmap. */
-#define RING_BUFFER_GET_MMAP_LEN _IOR(0xF6, 0x0A, unsigned long)
-/* returns the offset of the subbuffer belonging to the mmap reader. */
-#define RING_BUFFER_GET_MMAP_READ_OFFSET _IOR(0xF6, 0x0B, unsigned long)
-/* flush the current sub-buffer */
-#define RING_BUFFER_FLUSH _IO(0xF6, 0x0C)
-
-#endif /* _LINUX_RING_BUFFER_VFS_H */
tracepoint.c \
trace_event.c \
ltt-tracer.h \
- ltt-tracer-core.h
+ ltt-tracer-core.h \
+ ltt-ring-buffer-client.h \
+ ltt-ring-buffer-client-discard.c \
+ ltt-ring-buffer-client-overwrite.c \
+ ltt-ring-buffer-metadata-client.h \
+ ltt-ring-buffer-metadata-client.c
#removed: buffers.c buffers.h
* Dual LGPL v2.1/GPL v2 license.
*/
-#include <linux/list.h>
-#include <linux/uuid.h>
-#include <linux/kprobes.h>
-#include "ltt-debugfs-abi.h"
+#include <urcu/list.h>
+#include <uuid/uuid.h>
+#include <stdint.h>
+#include <ust/lttng-ust-abi.h>
#undef is_signed_type
#define is_signed_type(type) (((type)(-1)) < 0)
struct ltt_channel;
struct ltt_session;
struct lib_ring_buffer_ctx;
-struct perf_event;
-struct perf_event_attr;
/* Type description */
struct lib_ring_buffer_ctx *ctx,
struct ltt_channel *chan);
union {
- struct {
- struct perf_event **e; /* per-cpu array */
- struct notifier_block nb;
- int hp_enable;
- struct perf_event_attr *attr;
- } perf_counter;
} u;
void (*destroy)(struct lttng_ctx_field *field);
};
const struct lttng_event_ctx *ctx; /* context */
const struct lttng_event_field *fields; /* event payload */
unsigned int nr_fields;
- struct module *owner;
};
struct lttng_probe_desc {
const struct lttng_event_desc *event_desc;
unsigned int nr_events;
- struct list_head head; /* chain registered probes */
+ struct cds_list_head head; /* chain registered probes */
};
/*
const struct lttng_event_desc *desc;
void *filter;
struct lttng_ctx *ctx;
- enum lttng_kernel_instrumentation instrumentation;
+ enum lttng_ust_instrumentation instrumentation;
union {
- struct {
- struct kprobe kp;
- char *symbol_name;
- } kprobe;
- struct {
- char *symbol_name;
- } ftrace;
} u;
- struct list_head list; /* Event list */
+ struct cds_list_head list; /* Event list */
int metadata_dumped:1;
};
void *buf_addr,
size_t subbuf_size, size_t num_subbuf,
unsigned int switch_timer_interval,
- unsigned int read_timer_interval);
+ unsigned int read_timer_interval,
+ int *shmid);
void (*channel_destroy)(struct channel *chan);
struct lib_ring_buffer *(*buffer_read_open)(struct channel *chan);
void (*buffer_read_close)(struct lib_ring_buffer *buf);
* may change due to concurrent writes.
*/
size_t (*packet_avail_size)(struct channel *chan);
- wait_queue_head_t *(*get_reader_wait_queue)(struct channel *chan);
- wait_queue_head_t *(*get_hp_wait_queue)(struct channel *chan);
+ //wait_queue_head_t *(*get_reader_wait_queue)(struct channel *chan);
+ //wait_queue_head_t *(*get_hp_wait_queue)(struct channel *chan);
int (*is_finalized)(struct channel *chan);
int (*is_disabled)(struct channel *chan);
};
struct ltt_session *session;
struct file *file; /* File associated to channel */
unsigned int free_event_id; /* Next event ID to allocate */
- struct list_head list; /* Channel list */
+ struct cds_list_head list; /* Channel list */
struct ltt_channel_ops *ops;
int header_type; /* 0: unset, 1: compact, 2: large */
int metadata_dumped:1;
int been_active; /* Has trace session been active ? */
struct file *file; /* File associated to session */
struct ltt_channel *metadata; /* Metadata channel */
- struct list_head chan; /* Channel list head */
- struct list_head events; /* Event list head */
- struct list_head list; /* Session list */
+ struct cds_list_head chan; /* Channel list head */
+ struct cds_list_head events; /* Event list head */
+ struct cds_list_head list; /* Session list */
unsigned int free_chan_id; /* Next chan ID to allocate */
- uuid_le uuid; /* Trace session unique ID */
+ uuid_t uuid; /* Trace session unique ID */
int metadata_dumped:1;
};
struct ltt_transport {
char *name;
- struct module *owner;
- struct list_head node;
+ struct cds_list_head node;
struct ltt_channel_ops ops;
};
unsigned int read_timer_interval);
struct ltt_event *ltt_event_create(struct ltt_channel *chan,
- struct lttng_kernel_event *event_param,
+ struct lttng_ust_event *event_param,
void *filter);
int ltt_channel_enable(struct ltt_channel *channel);
void ltt_transport_unregister(struct ltt_transport *transport);
void synchronize_trace(void);
-int ltt_debugfs_abi_init(void);
-void ltt_debugfs_abi_exit(void);
+//int ltt_debugfs_abi_init(void);
+//void ltt_debugfs_abi_exit(void);
int ltt_probe_register(struct lttng_probe_desc *desc);
void ltt_probe_unregister(struct lttng_probe_desc *desc);
void lttng_remove_context_field(struct lttng_ctx **ctx,
struct lttng_ctx_field *field);
void lttng_destroy_context(struct lttng_ctx *ctx);
-int lttng_add_pid_to_ctx(struct lttng_ctx **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_perf_counter_to_ctx(uint32_t type,
- uint64_t config,
- const char *name,
- struct lttng_ctx **ctx);
-
-#ifdef CONFIG_KPROBES
-int lttng_kprobes_register(const char *name,
- const char *symbol_name,
- uint64_t offset,
- uint64_t addr,
- struct ltt_event *event);
-void lttng_kprobes_unregister(struct ltt_event *event);
-void lttng_kprobes_destroy_private(struct ltt_event *event);
-#else
-static inline
-int lttng_kprobes_register(const char *name,
- const char *symbol_name,
- uint64_t offset,
- uint64_t addr,
- struct ltt_event *event)
-{
- return -ENOSYS;
-}
-
-static inline
-void lttng_kprobes_unregister(struct ltt_event *event)
-{
-}
-
-static inline
-void lttng_kprobes_destroy_private(struct ltt_event *event)
-{
-}
-#endif
-
-#ifdef CONFIG_DYNAMIC_FTRACE
-int lttng_ftrace_register(const char *name,
- const char *symbol_name,
- struct ltt_event *event);
-void lttng_ftrace_unregister(struct ltt_event *event);
-void lttng_ftrace_destroy_private(struct ltt_event *event);
-#else
-static inline
-int lttng_ftrace_register(const char *name,
- const char *symbol_name,
- struct ltt_event *event)
-{
- return -ENOSYS;
-}
-
-static inline
-void lttng_ftrace_unregister(struct ltt_event *event)
-{
-}
-
-static inline
-void lttng_ftrace_destroy_private(struct ltt_event *event)
-{
-}
-#endif
-
-extern const struct file_operations lttng_tracepoint_list_fops;
+int lttng_add_vtid_to_ctx(struct lttng_ctx **ctx);
+
+//extern const struct file_operations lttng_tracepoint_list_fops;
#endif /* _LTT_EVENTS_H */
* Dual LGPL v2.1/GPL v2 license.
*/
-#include <linux/module.h>
#include "ltt-tracer.h"
#define RING_BUFFER_MODE_TEMPLATE RING_BUFFER_DISCARD
#define RING_BUFFER_MODE_TEMPLATE_STRING "discard"
#include "ltt-ring-buffer-client.h"
-
-MODULE_LICENSE("GPL and additional rights");
-MODULE_AUTHOR("Mathieu Desnoyers");
-MODULE_DESCRIPTION("LTTng Ring Buffer Client Discard Mode");
* Dual LGPL v2.1/GPL v2 license.
*/
-#include <linux/module.h>
#include "ltt-tracer.h"
#define RING_BUFFER_MODE_TEMPLATE RING_BUFFER_OVERWRITE
#define RING_BUFFER_MODE_TEMPLATE_STRING "overwrite"
#include "ltt-ring-buffer-client.h"
-
-MODULE_LICENSE("GPL and additional rights");
-MODULE_AUTHOR("Mathieu Desnoyers");
-MODULE_DESCRIPTION("LTTng Ring Buffer Client Overwrite Mode");
* Dual LGPL v2.1/GPL v2 license.
*/
-#include <linux/module.h>
-#include <linux/types.h>
-#include "lib/bitfield.h"
-#include "wrapper/vmalloc.h" /* for wrapper_vmalloc_sync_all() */
-#include "wrapper/trace-clock.h"
+#include <stdint.h>
+#include "ust/bitfield.h"
+#include "ust/clock.h"
#include "ltt-events.h"
#include "ltt-tracer.h"
-#include "wrapper/ringbuffer/frontend_types.h"
+#include "../libringbuffer/frontend_types.h"
/*
* Keep the natural field alignment for _each field_ within this structure if
}
break;
default:
+ padding = 0;
WARN_ON_ONCE(1);
}
offset += ctx_get_size(offset, event->ctx);
return offset - orig_offset;
}
-#include "wrapper/ringbuffer/api.h"
+#include "../libringbuffer/api.h"
-extern
+static
void ltt_write_event_header_slow(const struct lib_ring_buffer_config *config,
struct lib_ring_buffer_ctx *ctx,
uint32_t event_id);
ltt_write_event_header_slow(config, ctx, event_id);
}
+static
void ltt_write_event_header_slow(const struct lib_ring_buffer_config *config,
struct lib_ring_buffer_ctx *ctx,
uint32_t event_id)
static void client_buffer_begin(struct lib_ring_buffer *buf, u64 tsc,
unsigned int subbuf_idx)
{
- struct channel *chan = buf->backend.chan;
+ struct channel *chan = shmp(buf->backend.chan);
struct packet_header *header =
(struct packet_header *)
lib_ring_buffer_offset_address(&buf->backend,
struct ltt_session *session = ltt_chan->session;
header->magic = CTF_MAGIC_NUMBER;
- memcpy(header->uuid, session->uuid.b, sizeof(session->uuid));
+ memcpy(header->uuid, session->uuid, sizeof(session->uuid));
header->stream_id = ltt_chan->id;
header->ctx.timestamp_begin = tsc;
header->ctx.timestamp_end = 0;
static void client_buffer_end(struct lib_ring_buffer *buf, u64 tsc,
unsigned int subbuf_idx, unsigned long data_size)
{
- struct channel *chan = buf->backend.chan;
+ struct channel *chan = shmp(buf->backend.chan);
struct packet_header *header =
(struct packet_header *)
lib_ring_buffer_offset_address(&buf->backend,
struct ltt_channel *ltt_chan, void *buf_addr,
size_t subbuf_size, size_t num_subbuf,
unsigned int switch_timer_interval,
- unsigned int read_timer_interval)
+ unsigned int read_timer_interval,
+ int *shmid)
{
return channel_create(&client_config, name, ltt_chan, buf_addr,
subbuf_size, num_subbuf, switch_timer_interval,
- read_timer_interval);
+ read_timer_interval, shmid);
}
static
lib_ring_buffer_write(&client_config, ctx, src, len);
}
+#if 0
static
wait_queue_head_t *ltt_get_reader_wait_queue(struct channel *chan)
{
{
return &chan->hp_wait;
}
+#endif //0
static
int ltt_is_finalized(struct channel *chan)
static struct ltt_transport ltt_relay_transport = {
.name = "relay-" RING_BUFFER_MODE_TEMPLATE_STRING,
- .owner = THIS_MODULE,
.ops = {
.channel_create = _channel_create,
.channel_destroy = ltt_channel_destroy,
.event_commit = ltt_event_commit,
.event_write = ltt_event_write,
.packet_avail_size = NULL, /* Would be racy anyway */
- .get_reader_wait_queue = ltt_get_reader_wait_queue,
- .get_hp_wait_queue = ltt_get_hp_wait_queue,
+ //.get_reader_wait_queue = ltt_get_reader_wait_queue,
+ //.get_hp_wait_queue = ltt_get_hp_wait_queue,
.is_finalized = ltt_is_finalized,
.is_disabled = ltt_is_disabled,
},
};
-static int __init ltt_ring_buffer_client_init(void)
+static
+void __attribute__((constructor)) ltt_ring_buffer_client_init(void)
{
- /*
- * This vmalloc sync all also takes care of the lib ring buffer
- * vmalloc'd module pages when it is built as a module into LTTng.
- */
- wrapper_vmalloc_sync_all();
- printk(KERN_INFO "LTT : ltt ring buffer client init\n");
+ printf("LTT : ltt ring buffer client init\n");
ltt_transport_register(<t_relay_transport);
- return 0;
}
-module_init(ltt_ring_buffer_client_init);
-
-static void __exit ltt_ring_buffer_client_exit(void)
+static
+void __attribute__((destructor)) ltt_ring_buffer_client_exit(void)
{
- printk(KERN_INFO "LTT : ltt ring buffer client exit\n");
+ printf("LTT : ltt ring buffer client exit\n");
ltt_transport_unregister(<t_relay_transport);
}
-
-module_exit(ltt_ring_buffer_client_exit);
-
-MODULE_LICENSE("GPL and additional rights");
-MODULE_AUTHOR("Mathieu Desnoyers");
-MODULE_DESCRIPTION("LTTng ring buffer " RING_BUFFER_MODE_TEMPLATE_STRING
- " client");
* Dual LGPL v2.1/GPL v2 license.
*/
-#include <linux/module.h>
#include "ltt-tracer.h"
#define RING_BUFFER_MODE_TEMPLATE RING_BUFFER_DISCARD
#define RING_BUFFER_MODE_TEMPLATE_STRING "metadata"
#include "ltt-ring-buffer-metadata-client.h"
-
-MODULE_LICENSE("GPL and additional rights");
-MODULE_AUTHOR("Mathieu Desnoyers");
-MODULE_DESCRIPTION("LTTng Ring Buffer Metadata Client");
* Dual LGPL v2.1/GPL v2 license.
*/
-#include <linux/module.h>
-#include <linux/types.h>
-#include "wrapper/vmalloc.h" /* for wrapper_vmalloc_sync_all() */
+#include <stdint.h>
+#include "ust/bitfield.h"
#include "ltt-events.h"
#include "ltt-tracer.h"
+#include "../libringbuffer/frontend_types.h"
struct metadata_packet_header {
uint32_t magic; /* 0x75D11D57 */
return 0;
}
-#include "wrapper/ringbuffer/api.h"
+#include "../libringbuffer/api.h"
static u64 client_ring_buffer_clock_read(struct channel *chan)
{
static void client_buffer_begin(struct lib_ring_buffer *buf, u64 tsc,
unsigned int subbuf_idx)
{
- struct channel *chan = buf->backend.chan;
+ struct channel *chan = shmp(buf->backend.chan);
struct metadata_packet_header *header =
(struct metadata_packet_header *)
lib_ring_buffer_offset_address(&buf->backend,
struct ltt_session *session = ltt_chan->session;
header->magic = TSDL_MAGIC_NUMBER;
- memcpy(header->uuid, session->uuid.b, sizeof(session->uuid));
+ memcpy(header->uuid, session->uuid, sizeof(session->uuid));
header->checksum = 0; /* 0 if unused */
header->content_size = 0xFFFFFFFF; /* in bits, for debugging */
header->packet_size = 0xFFFFFFFF; /* in bits, for debugging */
static void client_buffer_end(struct lib_ring_buffer *buf, u64 tsc,
unsigned int subbuf_idx, unsigned long data_size)
{
- struct channel *chan = buf->backend.chan;
+ struct channel *chan = shmp(buf->backend.chan);
struct metadata_packet_header *header =
(struct metadata_packet_header *)
lib_ring_buffer_offset_address(&buf->backend,
struct ltt_channel *ltt_chan, void *buf_addr,
size_t subbuf_size, size_t num_subbuf,
unsigned int switch_timer_interval,
- unsigned int read_timer_interval)
+ unsigned int read_timer_interval,
+ int *shmid)
{
return channel_create(&client_config, name, ltt_chan, buf_addr,
subbuf_size, num_subbuf, switch_timer_interval,
- read_timer_interval);
+ read_timer_interval, shmid);
}
static
unsigned long o_begin;
struct lib_ring_buffer *buf;
- buf = chan->backend.buf; /* Only for global buffer ! */
+ buf = shmp(chan->backend.buf); /* Only for global buffer ! */
o_begin = v_read(&client_config, &buf->offset);
if (subbuf_offset(o_begin, chan) != 0) {
return chan->backend.subbuf_size - subbuf_offset(o_begin, chan);
}
}
+#if 0
static
wait_queue_head_t *ltt_get_reader_wait_queue(struct channel *chan)
{
{
return &chan->hp_wait;
}
+#endif //0
static
int ltt_is_finalized(struct channel *chan)
static struct ltt_transport ltt_relay_transport = {
.name = "relay-" RING_BUFFER_MODE_TEMPLATE_STRING,
- .owner = THIS_MODULE,
.ops = {
.channel_create = _channel_create,
.channel_destroy = ltt_channel_destroy,
.event_commit = ltt_event_commit,
.event_write = ltt_event_write,
.packet_avail_size = ltt_packet_avail_size,
- .get_reader_wait_queue = ltt_get_reader_wait_queue,
- .get_hp_wait_queue = ltt_get_hp_wait_queue,
+ //.get_reader_wait_queue = ltt_get_reader_wait_queue,
+ //.get_hp_wait_queue = ltt_get_hp_wait_queue,
.is_finalized = ltt_is_finalized,
.is_disabled = ltt_is_disabled,
},
};
-static int __init ltt_ring_buffer_client_init(void)
+static
+void __attribute__((constructor)) ltt_ring_buffer_client_init(void)
{
- /*
- * This vmalloc sync all also takes care of the lib ring buffer
- * vmalloc'd module pages when it is built as a module into LTTng.
- */
- wrapper_vmalloc_sync_all();
- printk(KERN_INFO "LTT : ltt ring buffer metadata client init\n");
+ printf("LTT : ltt ring buffer client init\n");
ltt_transport_register(<t_relay_transport);
- return 0;
}
-module_init(ltt_ring_buffer_client_init);
-
-static void __exit ltt_ring_buffer_client_exit(void)
+static
+void __attribute__((destructor)) ltt_ring_buffer_client_exit(void)
{
- printk(KERN_INFO "LTT : ltt ring buffer metadata client exit\n");
+ printf("LTT : ltt ring buffer client exit\n");
ltt_transport_unregister(<t_relay_transport);
}
-
-module_exit(ltt_ring_buffer_client_exit);
-
-MODULE_LICENSE("GPL and additional rights");
-MODULE_AUTHOR("Mathieu Desnoyers");
-MODULE_DESCRIPTION("LTTng ring buffer " RING_BUFFER_MODE_TEMPLATE_STRING
- " client");
#define RING_BUFFER_ALIGN
#endif
+#include "usterr_signal_safe.h"
+#include "ust/bug.h"
#include "../libringbuffer/config.h"
struct ltt_session;
struct ltt_channel;
struct ltt_event;
-#define /* _LTT_TRACER_CORE_H */
+#endif /* _LTT_TRACER_CORE_H */