Import lib ring buffer into LTTng modules
[lttng-modules.git] / ltt-tracer.h
index 1ca13a99aa7a22af873f1e8e462f320108d9fb94..f4d1ef847a1adb13f86520e9dec2e607ed95f883 100644 (file)
 #include <linux/cache.h>
 #include <linux/timex.h>
 #include <linux/wait.h>
-#include <linux/trace-clock.h>
 #include <asm/atomic.h>
 #include <asm/local.h>
 
+#include "wrapper/trace-clock.h"
 #include "ltt-tracer-core.h"
 #include "ltt-events.h"
 
@@ -72,71 +72,6 @@ enum ltt_channels {
        LTT_CHANNEL_DEFAULT,
 };
 
-#if 0
-size_t ltt_serialize_printf(struct lib_ring_buffer *buf, unsigned long buf_offset,
-                           size_t *msg_size, char *output, size_t outlen,
-                           const char *fmt);
-
-/*
- * Unique ID assigned to each registered probe.
- */
-enum marker_id {
-       MARKER_ID_SET_MARKER_ID = 0,    /* Static IDs available (range 0-7) */
-       MARKER_ID_SET_MARKER_FORMAT,
-       MARKER_ID_COMPACT,              /* Compact IDs (range: 8-127)       */
-       MARKER_ID_DYNAMIC,              /* Dynamic IDs (range: 128-65535)   */
-};
-
-/* static ids 0-1 reserved for internal use. */
-#define MARKER_CORE_IDS                2
-static __inline__ enum marker_id marker_id_type(uint16_t id)
-{
-       if (id < MARKER_CORE_IDS)
-               return (enum marker_id)id;
-       else
-               return MARKER_ID_DYNAMIC;
-}
-
-struct user_dbg_data {
-       unsigned long avail_size;
-       unsigned long write;
-       unsigned long read;
-};
-
-enum trace_mode { LTT_TRACE_NORMAL, LTT_TRACE_FLIGHT, LTT_TRACE_HYBRID };
-
-#define CHANNEL_FLAG_ENABLE    (1U<<0)
-#define CHANNEL_FLAG_OVERWRITE (1U<<1)
-#endif //0
-
-#if 0
-/* Per-trace information - each trace/flight recorder represented by one */
-struct ltt_trace {
-       /* First 32 bytes cache-hot cacheline */
-       struct list_head list;
-       struct ltt_chan **channels;
-       unsigned int nr_channels;
-       int active;
-       /* Second 32 bytes cache-hot cacheline */
-       struct ltt_trace_ops *ops;
-       u32 freq_scale;
-       u64 start_freq;
-       u64 start_tsc;
-       unsigned long long start_monotonic;
-       struct timeval          start_time;
-       struct ltt_channel_setting *settings;
-       struct {
-               struct dentry                   *trace_root;
-               struct dentry                   *ascii_root;
-       } dentry;
-       struct kref kref; /* Each channel has a kref of the trace struct */
-       struct ltt_transport *transport;
-       struct kref ltt_transport_kref;
-       wait_queue_head_t kref_wq; /* Place for ltt_trace_destroy to sleep */
-       char trace_name[NAME_MAX];
-} ____cacheline_aligned;
-#endif //0
-
 /*
  * Hardcoded event headers
  *
@@ -273,7 +208,7 @@ unsigned char record_header_size(const struct lib_ring_buffer_config *config,
                        offset += sizeof(u16) + sizeof(u16);
                        if (data_size >= LTT_MAX_SMALL_SIZE)
                                offset += sizeof(u32);
-                       offset += ltt_align(offset, sizeof(u64));
+                       offset += lib_ring_buffer_align(offset, sizeof(u64));
                        offset += sizeof(u64);
                        break;
                case LTT_RFLAG_ID_SIZE:
@@ -291,7 +226,7 @@ unsigned char record_header_size(const struct lib_ring_buffer_config *config,
        return offset - orig_offset;
 }
 
-#include <linux/ringbuffer/api.h>
+#include "wrapper/ringbuffer/api.h"
 
 extern
 void ltt_write_event_header_slow(const struct lib_ring_buffer_config *config,
@@ -326,70 +261,6 @@ slow_path:
        ltt_write_event_header_slow(config, ctx, eID, event_size);
 }
 
-#if 0
-/*
- * ltt_read_event_header
- * buf_offset must aligned on 32 bits
- */
-static __inline__
-size_t ltt_read_event_header(struct ltt_chanbuf_alloc *bufa, long buf_offset,
-                            u64 *tsc, u32 *event_size, u16 *eID,
-                            unsigned int *rflags)
-{
-       struct ltt_event_header header;
-       u16 small_size;
-
-       ltt_relay_read(bufa, buf_offset, &header, sizeof(header));
-       buf_offset += sizeof(header);
-
-       *event_size = INT_MAX;
-       *eID = header.id_time >> LTT_TSC_BITS;
-       *tsc = header.id_time & LTT_TSC_MASK;
-
-       switch (*eID) {
-       case 29:
-               *rflags = LTT_RFLAG_ID_SIZE_TSC;
-               ltt_relay_read(bufa, buf_offset, eID, sizeof(u16));
-               buf_offset += sizeof(u16);
-               ltt_relay_read(bufa, buf_offset, &small_size, sizeof(u16));
-               buf_offset += sizeof(u16);
-               if (small_size == LTT_MAX_SMALL_SIZE) {
-                       ltt_relay_read(bufa, buf_offset, event_size,
-                                       sizeof(u32));
-                       buf_offset += sizeof(u32);
-               } else
-                       *event_size = small_size;
-               buf_offset += ltt_align(buf_offset, sizeof(u64));
-               ltt_relay_read(bufa, buf_offset, tsc, sizeof(u64));
-               buf_offset += sizeof(u64);
-               break;
-       case 30:
-               *rflags = LTT_RFLAG_ID_SIZE;
-               ltt_relay_read(bufa, buf_offset, eID, sizeof(u16));
-               buf_offset += sizeof(u16);
-               ltt_relay_read(bufa, buf_offset, &small_size, sizeof(u16));
-               buf_offset += sizeof(u16);
-               if (small_size == LTT_MAX_SMALL_SIZE) {
-                       ltt_relay_read(bufa, buf_offset, event_size,
-                                       sizeof(u32));
-                       buf_offset += sizeof(u32);
-               } else
-                       *event_size = small_size;
-               break;
-       case 31:
-               *rflags = LTT_RFLAG_ID;
-               ltt_relay_read(bufa, buf_offset, eID, sizeof(u16));
-               buf_offset += sizeof(u16);
-               break;
-       default:
-               *rflags = 0;
-               break;
-       }
-
-       return buf_offset;
-}
-#endif //0
-
 /* Tracer properties */
 #define CTF_MAGIC_NUMBER               0xC1FC1FC1
 #define LTT_TRACER_VERSION_MAJOR       3
This page took 0.024511 seconds and 4 git commands to generate.